Click to See Complete Forum and Search --> : passing jsp variable to javascript


aisyah
10-06-2003, 03:19 AM
i have variable in jsp called temp1,
I want to used the temp1 value inside my javascript.
I have tried as below but received error : unresolved symbol temp1


<script language="javascript">
var tempused = <%=temp1%>;
function test()
{

javascript code here .....

}

</script>

Please help... urgent


regards

Khalid Ali
10-06-2003, 09:35 AM
if variable is an integer value then
<script language="javascript">
var tempused = <%=temp1%>;

should work
if its a string value

<script language="javascript">
var tempused = "<%=temp1%>";

will work

aisyah
10-06-2003, 09:21 PM
Originally posted by Khalid Ali
if variable is an integer value then
<script language="javascript">
var tempused = <%=temp1%>;

should work
if its a string value

<script language="javascript">
var tempused = "<%=temp1%>";

will work



thanks for the reply.
I try as you advised but still get the error unresolved symbol temp1

Please help

- aisyah -

aisyah
10-06-2003, 10:11 PM
Originally posted by aisyah
thanks for the reply.
I try as you advised but still get the error unresolved symbol temp1

Please help

- aisyah -


Khalid ..
Please ignore my previous reply...
It works now ...


thanks

Khalid Ali
10-06-2003, 10:36 PM
You are welcome,,,