Прошу Помощи!
при динамической загрузки страници с javascript'ом он перестаёт работать, вот содержание файлов
index.html
<html>
<body>
<script src="js.js" language="javascript"></script>
<div id="info">content</div>
<input type="button" value="content" onclick="n_links()" />
</body>
</html>
content.html
<html>
<body>
<script language="javascript" type="text/javascript">
function ok() {
alert ('work');
}
</script>
<input type="button" value="go" onclick="ok()" />
</body>
</html>
js.js
/* ------------------------ */
/* XMLHTTPRequest Enable */
/* ------------------------ */
function createObject() {
var request_type;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_type = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_type = new XMLHttpRequest();
}
return request_type;
}
var https = createObject();
/* ------------------------ */
/* noexit */
/* ------------------------ */
function n_links() {
nocache = Math.random();
https.open('get', 'content.html?nocache='+nocache);
https.onreadystatechange = user_replay;
https.send(null);
}
function user_replay () {
if(https.readyState == 4) {
var response = https.responseText;
document.getElementById('info').innerHTML = response;
}
}
т.е при загрузки динамически страници content.html где присутствует простейший скрипт, на страницу index.html с помощью js.js, скрипт который находистя в content.html перестаёт работать, подскажите пожалуйста, в чем проблемма?
зарание спасибо!
|