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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Response.Write

Status
Not open for further replies.

dace

Programmer
Jul 21, 2001
263
US
Hi everyone-

I'm using response.write in an asp.net codebehind to add some javascript to the http response:

Response.Write("<script language=""javascript""> document.getElementById('PageContentFrame').location.href='WebForm3.aspx' </script>")

Basically,, I want this to set the contents of an iframe. However, it appears that when this javascript fires, the page hasn't been rendered yet, so there's no object there for it to set the location for. I don't know when/where the response.write goes.

Does anyone have any suggestions about how to get around this?

Thanks!
 
Use chr(34) instead of "

Like:

Response.Write "<script language=" & chr(34) & "javascript" & chr(34) & "> document.getElementById('PageContentFrame').location.href='WebForm3.aspx' </script>
 
Try
{
forum855
}
Catch
{
"The wrong forum topic"
}
Finally
{
"Red Flag your own posting in the incorrect forum to keep things clean"
}

[wink]

___________________________________________________________________

The answer to your ??'s may be closer then you think. faq333-3811
Join the Northern Illinois/Southern Wisconsin members in Forum1064
 
Whoops, I looked for a .net forum and didn't see one.. sorry [ponder]
 
even though you're writing in asp.net it's a common ASP issue, make sure you response.flush through the page, then right before the </body> response your script there, and highly recommend adding a settimeout(script,500); on it at least 500 maybe even 1000, to ensure the page is fully xmitted before trying to find things client side.

 
onpnt :
You're a bad man !!! (fair point though).

dace : don't stress, mosy on over to asp.net forum (if you haven't already).

Have a good weekend all.




--------------------------------------------------
Free Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top