jQuery in Action, 3rd edition
The moose likes HTML, CSS and JavaScript and the fly likes Problem with script tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply locked New topic

Problem with script tag

Anup Srivastava

Joined: Dec 21, 2005
Posts: 21
I am trying to perform following operation

function getValue(){
document.form1.brief.value = '<%=briefstr %>';

where "brief" is a hidden variable and "briefstr" is a Java String variable and consists of javascript contents. when javascript inside value closes, that </script> tag closes script in my jsp file and gives javascript Error I need to assign these value onload of body for rest of the cose. How can i handle it?
Manesh Kumar
Ranch Hand

Joined: Mar 21, 2006
Posts: 94
onload event is fired when the body of the content is being loaded, yet still not completed. So there is a possiblity to get the script since the hidden variable is still yet to be drawn.

You can you onreasystatechange event handler on the document object and then check for readystatechange property for completeness.

If this has to loaded when the document is loaded you can directly the value of briefstr to the hidden variable.

Hope this helps.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63838

Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link: http://aspose.com/file-tools
subject: Problem with script tag
It's not a secret anymore!