Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADVANCED ASP: accessing innerHTML

Status
Not open for further replies.

mattscotney

Programmer
Jul 31, 2002
57
AU
Hi everyone,

Is it possible to access innerHTML using asp?

If yes, how do I convert to innerHTML in conjunction with the InetCtls.Inet controls?

Thanks in advance,
Matt Scotney
 
if my understanding is correct, the answer is no. you can't use ASP to work with innerHTML. the reasoning is that innerHTML is specific to an existing HTML document that is being displayed in a browser. ASP is a server side technology and does its work before a document reaches a browser and is displayed.

looking at it another way, the point of innerHTML is to change the contents between an opening and closing tag for the currently displayed document in a browser. with ASP, you have the ability to alter the document by writing the HTML tags and the tag's contents before the document is sent to the browser.

for example...

Code:
if conditionA then
   response.write &quot;<p id='p1'>innerHTML stuff</p>&quot;
else
   response.write &quot;<p id='p1'>different innerHTML stuff</p>&quot;
end if

hope that helps,

glenn
 
You can do it by using Javascript and DHTML. Just go to msdn.microsoft.com and look at the jscript reference.

Ted
 
Thanks guys, but I think from your answers I need explain my question in more specific detail:

I have generated a new window / page from a submitted form.
EXAMPLE: the user enters a url and through asp using the InetCtls.Inet controls or Microsoft.XMLHTTP I can dynamically generate a new window which displays the page the user enters.

I can also produce the source of the page in the new window when I require it.

Using the following javascript I can grab the innerHTML from the page (generated source that the browser displays. NOT the regular view source) and display it on the current page:

<SCRIPT LANGUAGE= Javascript>

function show()
{
z = window();
z.document.write('<pre>' + repl('<html>\n' + document.documentElement.innerHTML + '\n</html>'));
z.document.close();
}

function repl(x)
{
x=x.replace(/&/g,'&');
x=x.replace(/>/g,'>');
x=x.replace(/</g,'<');
return x;
}

</SCRIPT>

How can I grab the generated source from the page using ASP?

I hope this clears things up.

Thanks in advance,
Matt Scotney
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top