Jack wrote:
Hello,
I wrote this code:
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
dim ab
ab=0
Response.Write "<INPUT type=""text"" id=customername
name=customername onchange=""ab=ab+1"" value=""abc"">"
Response.Write "<BR>"
Response.Write "<INPUT type=""text"" id=text1 name=text1 value =" &
ab & ">"
...
</SCRIPT>
But onchange the customername's text ,ab's value was no plus.Can you
help me.
Your problem is lack of understanding where the code is executing.
Everything in the script block runs at the server. That means the variable
you declared in that script block is only visible to the code that is
running on the server.
The onchange event takes place at the client. The code running on the client
machine has no idea about any variables that were declared in the
server-side code.. You will need to write some client-side code to declare a
client-side variable in the window's onload event, along with code in the
INPUT's onchange event to display the new value for ab when it gets changed.
You should follow up on a client-side coding newsgroup (look for one with
"dhtml" in its name, or go to m.p.scripting.vbscript or
m.p.scripting.jscript)
HTH,
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"