...

View Full Version : http request don't keep the javascripts working



alapimba
11-06-2007, 03:17 PM
Hello
I'm doing an http request of one page, and when that page loads the javascripts on that page don't work.
theres anyway to fix this?

my request code is:

function replace<?php echo $row_rs_anos['id']; ?>() {
http.open("GET", "simple_accordions_with_src/Basic.html", true);
http.onreadystatechange=function() {
if(http.readyState == 4) {
document.getElementById('foo').innerHTML = http.responseText;
}
}
http.send(null);
}

anyone can help me?

shyam
11-06-2007, 04:01 PM
it won't innerHTML will only call the rendering portion of the browser and since the script tag is not something that will be part of the display it will be ignored. if u want scripts to execute u've to use DOM manipulation

alapimba
11-06-2007, 04:03 PM
hum... i see.. can you help me a bit more? i really don't know how to search.

shyam
11-06-2007, 04:11 PM
the simplest way out would be to use an iframe like


document.getElementById('foo').innerHTML = '<iframe src="simple_accordions_with_src/Basic.html"><' + '/iframe>';

to learn more about html dom http://www.w3schools.com/htmldom/default.asp



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum