|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
how to pass integer arguments to a function
i want to pass an integer to a function in the javascript & then retrieve that value on the next page..how do i do it...plz help..the sample code is given
<script> function storeCode(hay) { document.form1.ccode.value=hay; document.form1.submit(); } </script> <% int hay=9; %> <form name="form1" method="post" action="test1.jsp"> <p> <input TYPE="hidden" Name="ccode" value=""> <a href="#" onClick="storeCode('hay'); return false">abc</a></p> <p> </p> </form> i want to pass the value of hay i.e 9 to the function to set the ccode which i wil retrieve on next page.Right now it set the varible to "hay" instead of its value.....plz help.....plz help |
|
#2
|
||||
|
||||
|
In order for this to work as you wish, you'll need to have your ASP write your javascript. You're trying to use an ASP variable in a javascript call, and it just doesn't work that way. Either hard-code the value or stick an ASP echo/print statement in your code to echo the value in the appropriate place (the hidden field, for example).
__________________
Please don't PM me asking for solutions outside the scope of a thread. Keeping all responses in a thread stands to help others who come along later, which is after all what this forum's all about. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > how to pass integer arguments to a function |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|