MarkMan55 Posted February 8, 2007 Share Posted February 8, 2007 I'm using AJAX and making a call to load a file in a div. The problem I'm having is making the file/document display at an anchor point. Ex: page1.html has four anchors and I want to use use AJAX to load the doc into a div and have it display at anchor point 3. When I make a call to load the page, nothing happens in IE6 and the page just loads at the top in Firefox. Here is some example code: function ajax() { var args = ajax.arguments; switch (args[0]) { case "load": if (document.getElementById) { var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); } if (x) { x. /> { if (x.readyState == 4 && x.status == 200) { el = document.getElementById(args[2]); el.innerHTML = x.responseText; } } x.open("GET", args[1], true); x.send(null); } break; case "clear": el = document.getElementById(args[2]); el.innerHTML = ""; break; } } ...... <span return openNew(this.href);" href="http://www/" rel="nofollow" target="_blank">http://www.<anywhere>.com/dir/doc1.html#anchor1', 'displaydiv');">see document below</span> <div id="displaydiv"></div> ... and the code for the "doc1.html" file being loaded: <a id="anchor1"></a> text...... <a id="anchor2"></a>text...... <a id="anchor3"></a>text...... <a id="anchor4"></a>text...... <a id="anchor5"></a>text...... Link to comment https://forums.phpfreaks.com/topic/37656-how-to-call-a-page-to-load-in-a-div-asynchronously-and-display-at-anchor-point/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.