471,075 Members | 762 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,075 software developers and data experts.

How text101 can't show 'eee'

I wrote this code:
<SCRIPT LANGUAGE=JScript RUNAT=Server>
....
Response.Write("<INPUT type=text id=text100 name=text100
onchange='text101.value=eee'>");
Response.Write("<BR>");
Response.Write("<INPUT type=text id=text101 name=text101 >");
Response.Write("<BR>");
....
</SCRIPT>
But,when text100's onchange,text101 not show 'eee'.
Can you help me

Jul 19 '05 #1
9 2203
"eee" must be in quotes as well, so you have to double them up to include
them:
Response.Write("<input ... onchange='text101.value=""eee"";'>")


"Jack" <si*****************@yahoo.co.jp> wrote in message
news:ua**************@TK2MSFTNGP11.phx.gbl...
I wrote this code:
<SCRIPT LANGUAGE=JScript RUNAT=Server>
...
Response.Write("<INPUT type=text id=text100 name=text100
onchange='text101.value=eee'>");
Response.Write("<BR>");
Response.Write("<INPUT type=text id=text101 name=text101 >");
Response.Write("<BR>");
...
</SCRIPT>
But,when text100's onchange,text101 not show 'eee'.
Can you help me

Jul 19 '05 #2
Because in that context, eee is an undefined variable, not a string. Look
at a view source, It'll say:

<INPUT type=text id=text100 name=text100 onchange='text101.value=eee'>

You want it to say:

<INPUT type=text id=text100 name=text100 onchange="text101.value='eee';">

To get that, you'd either just stick it in html out of your script block, or
response.write it like:

Response.Write("<INPUT type=text id=text100 name=text100
onchange=\"text101.value='eee';\">");

Ray at home
"Jack" <si*****************@yahoo.co.jp> wrote in message
news:ua**************@TK2MSFTNGP11.phx.gbl...
I wrote this code:
<SCRIPT LANGUAGE=JScript RUNAT=Server>
...
Response.Write("<INPUT type=text id=text100 name=text100
onchange='text101.value=eee'>");
Response.Write("<BR>");
Response.Write("<INPUT type=text id=text101 name=text101 >");
Response.Write("<BR>");
...
</SCRIPT>
But,when text100's onchange,text101 not show 'eee'.
Can you help me

Jul 19 '05 #3
This is what you call VJ Script. :P

Ray at home

"Aaron Bertrand [MVP]" <aa***@TRASHaspfaq.com> wrote in message
news:ez**************@TK2MSFTNGP12.phx.gbl...
"eee" must be in quotes as well, so you have to double them up to include
them:
Response.Write("<input ... onchange='text101.value=""eee"";'>")


"Jack" <si*****************@yahoo.co.jp> wrote in message
news:ua**************@TK2MSFTNGP11.phx.gbl...
I wrote this code:
<SCRIPT LANGUAGE=JScript RUNAT=Server>
...
Response.Write("<INPUT type=text id=text100 name=text100
onchange='text101.value=eee'>");
Response.Write("<BR>");
Response.Write("<INPUT type=text id=text101 name=text101 >");
Response.Write("<BR>");
...
</SCRIPT>
But,when text100's onchange,text101 not show 'eee'.
Can you help me


Jul 19 '05 #4
Thank you very much.
I wrote this code:
<SCRIPT LANGUAGE=JScript RUNAT=Server>
....
var abc;
abc=100;
Response.Write("text100:")
Response.Write("<INPUT type=text id=text100 name=text100
onchange=\"text101.value=" & abc & "\">");
Response.Write("<BR>");
Response.Write("<INPUT type=text id=text101 name=text101 >");
Response.Write("<BR>");
....
</SCRIPT>

But text100 can't be showed.
I want when text100 onchange,text101 show abc's value.
Can you help me

Jul 19 '05 #5
Please don't take these questions the wrong way.

Do you know jscript at all?
Do you understand the difference between server-side scripting and
client-side?

The concatenator operator in jscript is + not &.

Ray at home

"Jack" <si*****************@yahoo.co.jp> wrote in message
news:eI*************@TK2MSFTNGP11.phx.gbl...
Thank you very much.
I wrote this code:
<SCRIPT LANGUAGE=JScript RUNAT=Server>
...
var abc;
abc=100;
Response.Write("text100:")
Response.Write("<INPUT type=text id=text100 name=text100
onchange=\"text101.value=" & abc & "\">");
Response.Write("<BR>");
Response.Write("<INPUT type=text id=text101 name=text101 >");
Response.Write("<BR>");
...
</SCRIPT>

But text100 can't be showed.
I want when text100 onchange,text101 show abc's value.
Can you help me

Jul 19 '05 #6
> Response.Write("<INPUT type=text id=text100 name=text100
onchange=\"text101.value=" & abc & "\">");


You still need to put quotes around abc! Let's start with the basics:

Let's compare this:

Response.Write("<Input type=Text>");

With this:

Response.Write("<Input type=\"Text\">");

(View source to see the difference in the browser.)

Now, compare what you have posted, to this:

Response.Write("<input type=text name=text100 onchange=\"text101.value='" +
abc + "';\">");

Notice my extra quotes??? This is because abc is a variable in
*SERVER-SIDE* code, but it is just a string in *CLIENT-SIDE* code.

If you can't follow this, then I'll echo Ray and prefix this with no
offense, don't take this the wrong way, etc., but you need to go over some
basic ASP tutorials to grasp the difference between client-side and
server-side code. Also, if you're not that comfortable with JScript syntax,
I suggest sticking to VBScript on the server side. Far more examples out
there in VBScript, and far more people capable of helping you quickly...

Also, could you consider encoding your messages in a standard format?
iso-2022-jp does really weird things to my newsreader.
Jul 19 '05 #7
> Response.Write("<input type=text name=text100 onchange=\"text101.value='"
+
abc + "';\">");


(And also, you should fully reference the input field, for greatest browser
compatibility; e.g., document.formname.text101.value)
Jul 19 '05 #8
This problem was solved.
I don't know jscript at all.I will study more.
Thank you for your help!

Jul 19 '05 #9
I suggest you skip asp and go to asp.net if you don't know anything yet. If
you don't want to do that, I second the suggestion to use vbscript for ASP.

Ray at home

"Jack" <si*****************@yahoo.co.jp> wrote in message
news:OS**************@TK2MSFTNGP11.phx.gbl...
This problem was solved.
I don't know jscript at all.I will study more.
Thank you for your help!

Jul 19 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Bill H | last post: by
1 post views Thread by Selma_g | last post: by
12 posts views Thread by jdokos | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.