943,170 Members | Top Members by Rank

Ad:
Aug 31st, 2010
0

Loading Page in Specific Div using AHAH - http://microformats.org/wiki/rest/ahah

Expand Post »
Loading Page in Specific Div using AHAH - http://microformats.org/wiki/rest/ahah but unable to execute script



Main.html
=========
<html>
<head><title>Main Page</title></head>
<script type="text/javascript" src=GetPage.js>
</script>
<body>
<form method=get onsubmit="load('History.html','GetDiv'); return false;">
<input type="text" name="quota" value="">
</form>

<div id="GetDiv">

</div>
</body>
</html>



GetPage.js
===========
function ahah(url,target) {
document.getElementById(target).innerHTML = 'loading data...';
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
req.onreadystatechange = function() {ahahDone(target);};
req.open("GET", url, true);
req.send(null);
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.onreadystatechange = function() {ahahDone(target);};
req.open("GET", url, true);
req.send();
}
}
}


function ahahDone(target) {
// only if req is "loaded"
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200 || req.status == 304) {
results = req.responseText;
document.getElementById(target).innerHTML = results;
} else {
document.getElementById(target).innerHTML="ahah error:\n" +
req.statusText;
}
}
}


function load(name,div) {

ahah(name,div);
return false;

}


History.html
=============
<html>
<head><title>History Page</title></head>
<body>
<div id="History">
<p> History Page </p>
<SCRIPT language="javascript">
document.write("History Page");
</SCRIPT>
</div>
</body>
</html>


The Script works great. i am able to get the History.HTML Loaded perfectly under Div=GetDiv but i am unable to execute or run the Script under history.html page when its loaded under div.

Script on history.html page works well if opened in a new browser i.e. http://localhost/history.html

My main idea is to execute the script under history page and display it under GetDiv

Please Help !!!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
shaikhanu is offline Offline
2 posts
since Aug 2010
Sep 1st, 2010
0
Re: Loading Page in Specific Div using AHAH - http://microformats.org/wiki/rest/ahah
had the same problem before. on firefox, opera, safari the script will be execute but IE! you have to read the content of script tag and eval it. that was my solution long ago
Reputation Points: 6
Solved Threads: 19
Posting Whiz in Training
fatihpiristine is offline Offline
283 posts
since Sep 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: On Function Call
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: Prevew Picture not work inI.E and Crhome





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC