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
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: 56529
    
  14

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


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Problem with script tag
 
Similar Threads
Problem with closing script tag
generate id attribute of <p> tag dynamically
setting value for hidden tag
Jsp & JavaScript
How to get the managed bean property value inside the javascript method in facelets?