JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
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  
Old April 13th, 2004, 03:09 PM
itsharoon itsharoon is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 1 itsharoon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old April 13th, 2004, 03:25 PM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
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.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > how to pass integer arguments to a function


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway