Win a copy of The Java Performance Companion this week in the Performance forum!
    Bookmark Topic Watch Topic
  • New Topic

Problem with script tag

 
Anup Srivastava
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 94
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Marshal
Pie
Posts: 64970
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place.
 
    Bookmark Topic Watch Topic
  • New Topic