File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

Problem with script tag

Anup Srivastava
Greenhorn

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

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

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.


Manesh
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60998
    
  65

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] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with script tag