p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   JSP Basics (http://p2p.wrox.com/forumdisplay.php?f=92)
-   -   Response.Write won't work? (http://p2p.wrox.com/showthread.php?t=54659)

Ron Howerton February 27th, 2007 12:06 PM

Response.Write won't work?
 
This javascript code in the html below does nothing and provides no error message for why it isn't working:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
    <head>
        <meta content="JavaScript" name="vs_defaultClientScript">
    </head>
    <body id="bdySurvey" MS_POSITIONING="FlowLayout" style="color:;font-family:Arial;font-size:10pt;">
        <form name="frmSurvey" id="frmSurvey">
My text before the script<br/>

<script language="javascript">Response.Write("TEST TEXT");</script><br/>

my text after the script
        </form>
    </body>
</HTML>

If I replace the Response.Write with alert, I get a message box, so I know it's running the script. But I cannot seem to get any text to appear on my form. What am I doing wrong?

iamrakesh22 March 23rd, 2007 07:39 AM

Hi,

I think there is no object Response in javascript thats why you are not getting any text on the page. if you see your java script console in FireFox or enable java script validation in IE you'll get a java script error.
If you want to use jsp then use scriptlets or if you want to use java script then use
<script language="javascript">
document.getElementById("frmSurvey").innerHTML = "Test Text";
</script>

Regards,
Rakesh


All times are GMT -4. The time now is 04:27 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.