Solved

DHTML div.innerHTML Source

Posted on 2002-03-10
3
1,253 Views
Last Modified: 2008-09-30
Is there a way to set the innerHTML of a div (i.e. document.all.myDiv.innerHTML) to read from another file. In other words instead of this

  document.all.myDiv.innerHTML = "blah blah blah"

I want to do this

  document.all.myDiv.innerHTML = document.asp?queryvar

Anyway to do this? I tried using SSI's, but it wouldn't let me sub a JS variable into the middle of the include path for whatever reason (kept getting "The include file '/include/PerformerPop.asp?" + performer + "' was not found.").
0
Comment
Question by:Dyrewolf
3 Comments
 
LVL 23

Expert Comment

by:b1xml2
ID: 6854287
what you have to do is use either a frame or iframe to load the document, then under MSIE5+,
var oHTML = document.getElementsByTagName("HTML");
if (oHTML.length == 1) {
 document.all.myDiv.innerHTML = oHTML.item(0).outerHTML;
}
0
 
LVL 29

Accepted Solution

by:
Göran Andersson earned 100 total points
ID: 6854407
You can only include a physical file using SSI. The include is done on the server side, even before the asp code is executed.

You could use the xmlhttp object to request the page from javascript:

function XMLRemote(url)
{
     var objData=new ActiveXObject("Microsoft.XMLHTTP")
     objData.Open('Get',url, false);
     objData.Send();
     return objData.ResponseText;
}

document.all.myDiv.innerHTML=XMLRemote('document.asp?queryvar');
0
 

Author Comment

by:Dyrewolf
ID: 6859680
Perfect... thanks man
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question