0

The idea behind this page is a log will be loaded on the page, and if one of the lines in the log matches criteria I've set a regex up for. You'll be able to click it, and the line you've clicked will be passed to another page. My javascript looks something like this

 <% string variable ="this isnt going to work"; %>

<SCRIPT type="text/javascript">
<!--
function a(){
document.form0.action = "page-to-navigate-to.jsp";
document.getElementById('GenID').value= variable;
//document.getElementById('GenID').value="IF I JUST ENTER TEXT LIKE THIS IT WILL WORK";
document.form0.submit();}
-->
</SCRIPT>

<
 //code here that calls function "a"
>


<FORM name="form0" method="post" target="_blank">
<input type = "hidden" name="GenID">
</FORM>

I've excluded the parts of the code where the pattern matching is done because I can't even seem to get a simple string variable to work with this, but as the comments mention. If I just type in anything, what I have typed in will be passed to the next page no problem.

I'm pretty new to javascript so I very well may be doing something fundamentaly wrong

I'm greatfull for any help, thanks

infused
  • 24,000
  • 13
  • 68
  • 78
whit3y
  • 65
  • 7

1 Answers1

0

This is not JavaScript, but server side code.

<% string variable ="this isnt going to work"; %>

You might be able to do:

document.getElementById('GenID').value = "<%=variable%>";
user887675
  • 547
  • 2
  • 6
  • Writing out JSP variables is explained here: http://stackoverflow.com/questions/10488367/variable-from-jsp-to-the-html-page – user887675 Jun 20 '14 at 14:14