Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > How dim a client value

Reply
Thread Tools

How dim a client value

 
 
Jack
Guest
Posts: n/a
 
      11-11-2003
Hello,
I wrote this code:
<SCRIPT Language=VBScript RUNAT=Server>
dim ab
ab=40
Response.Write "<INPUT type=""button"" value=""Button1"" id=button1
onclick=""ab=" & ab & "+10"">"
Response.Write "<INPUT type=""button"" value=""Button2"" id=button2
onclick=""text1.value=ab"">"
Response.Write "<INPUT type=""button"" value=""Button3"" id=button2
onclick=""text2.value=" & ab & """>"
Response.Write "<BR>"
Response.Write "<INPUT type=""text"" id=text1 name=text1 >"
Response.Write "<INPUT type=""text"" id=text2 name=text2 >"
Response.Write "<BR>"
</SCRIPT>

After Click button1,when click button2 text1 shows 50,but when click button3
text2 shows 40.
Once again click button1,the result is the same.
I want once click button1,ab be plused 10.
That is to say button1 be clicked n times,I want ab=40+10*n
Can you help me

 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      11-11-2003

"Jack" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
> I wrote this code:
> <SCRIPT Language=VBScript RUNAT=Server>
> dim ab
> ab=40


That is server-side code.



> Response.Write "<INPUT type=""button"" value=""Button1"" id=button1
> onclick=""ab=" & ab & "+10"">"


"onclick" is a client-side event.


You cannot change the value of a server-side variable using client-side
code. You will have to reload the page on each click or something along
those lines. Example:

<%
Dim ab
If Request.Form("cmdSubmit") <> "" Then
ab = CInt(Request.Form("cmdSubmit")) + 10
Else
ab = 40
End If
%>
<form method="post">
<input type="submit" value="<%=ab%>" name="cmdSubmit">
</form>

Ray at home


 
Reply With Quote
 
 
 
 
Jack
Guest
Posts: n/a
 
      11-11-2003
Thank you very much

 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Multidimensional array, one dim fix, one dim dynamic Florian Kaufmann C++ 1 04-28-2010 01:21 PM
System.arraycopy (2 dim array) and growth of 2 dim array Denis Palas Java 1 11-11-2006 09:22 AM
Return inex position of value in multi dim array Andrew Poulos Javascript 5 03-05-2005 02:04 AM
OT: Infor for a Multi-Dim App Dragon MCSE 6 10-15-2004 06:43 PM



Advertisments