How text101 can't show 'eee'

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jack

    How text101 can't show 'eee'

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

  • Aaron Bertrand [MVP]

    #2
    Re: How text101 can't show 'eee'

    "eee" must be in quotes as well, so you have to double them up to include
    them:


    Response.Write( "<input ... onchange='text1 01.value=""eee" ";'>")




    "Jack" <significance20 0310a@yahoo.co. jp> wrote in message
    news:uaFJ2jAqDH A.3612@TK2MSFTN GP11.phx.gbl...[color=blue]
    > I wrote this code:
    > <SCRIPT LANGUAGE=JScrip t RUNAT=Server>
    > ...
    > Response.Write( "<INPUT type=text id=text100 name=text100
    > onchange='text1 01.value=eee'>" );
    > Response.Write( "<BR>");
    > Response.Write( "<INPUT type=text id=text101 name=text101 >");
    > Response.Write( "<BR>");
    > ...
    > </SCRIPT>
    > But,when text100's onchange,text10 1 not show 'eee'.
    > Can you help me
    >[/color]


    Comment

    • Ray at

      #3
      Re: How text101 can't show 'eee'

      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='text1 01.value=eee'>

      You want it to say:

      <INPUT type=text id=text100 name=text100 onchange="text1 01.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=\"text 101.value='eee' ;\">");

      Ray at home


      "Jack" <significance20 0310a@yahoo.co. jp> wrote in message
      news:uaFJ2jAqDH A.3612@TK2MSFTN GP11.phx.gbl...[color=blue]
      > I wrote this code:
      > <SCRIPT LANGUAGE=JScrip t RUNAT=Server>
      > ...
      > Response.Write( "<INPUT type=text id=text100 name=text100
      > onchange='text1 01.value=eee'>" );
      > Response.Write( "<BR>");
      > Response.Write( "<INPUT type=text id=text101 name=text101 >");
      > Response.Write( "<BR>");
      > ...
      > </SCRIPT>
      > But,when text100's onchange,text10 1 not show 'eee'.
      > Can you help me
      >[/color]


      Comment

      • Ray at

        #4
        Re: How text101 can't show 'eee'

        This is what you call VJ Script. :P

        Ray at home

        "Aaron Bertrand [MVP]" <aaron@TRASHasp faq.com> wrote in message
        news:ezj9PmAqDH A.2312@TK2MSFTN GP12.phx.gbl...[color=blue]
        > "eee" must be in quotes as well, so you have to double them up to include
        > them:
        >
        >
        > Response.Write( "<input ... onchange='text1 01.value=""eee" ";'>")
        >
        >
        >
        >
        > "Jack" <significance20 0310a@yahoo.co. jp> wrote in message
        > news:uaFJ2jAqDH A.3612@TK2MSFTN GP11.phx.gbl...[color=green]
        > > I wrote this code:
        > > <SCRIPT LANGUAGE=JScrip t RUNAT=Server>
        > > ...
        > > Response.Write( "<INPUT type=text id=text100 name=text100
        > > onchange='text1 01.value=eee'>" );
        > > Response.Write( "<BR>");
        > > Response.Write( "<INPUT type=text id=text101 name=text101 >");
        > > Response.Write( "<BR>");
        > > ...
        > > </SCRIPT>
        > > But,when text100's onchange,text10 1 not show 'eee'.
        > > Can you help me
        > >[/color]
        >
        >[/color]


        Comment

        • Jack

          #5
          Why text100 can't be showed

          Thank you very much.
          I wrote this code:
          <SCRIPT LANGUAGE=JScrip t RUNAT=Server>
          ....
          var abc;
          abc=100;
          Response.Write( "text100:")
          Response.Write( "<INPUT type=text id=text100 name=text100
          onchange=\"text 101.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,text10 1 show abc's value.
          Can you help me

          Comment

          • Ray at

            #6
            Re: Why text100 can't be showed

            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" <significance20 0310a@yahoo.co. jp> wrote in message
            news:eIK5w$AqDH A.372@TK2MSFTNG P11.phx.gbl...[color=blue]
            > Thank you very much.
            > I wrote this code:
            > <SCRIPT LANGUAGE=JScrip t RUNAT=Server>
            > ...
            > var abc;
            > abc=100;
            > Response.Write( "text100:")
            > Response.Write( "<INPUT type=text id=text100 name=text100
            > onchange=\"text 101.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,text10 1 show abc's value.
            > Can you help me
            >[/color]


            Comment

            • Aaron Bertrand [MVP]

              #7
              Re: Why text100 can't be showed

              > Response.Write( "<INPUT type=text id=text100 name=text100[color=blue]
              > onchange=\"text 101.value=" & abc & "\">");[/color]

              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=\"text 101.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.


              Comment

              • Aaron Bertrand [MVP]

                #8
                Re: Why text100 can't be showed

                > Response.Write( "<input type=text name=text100 onchange=\"text 101.value='"
                +[color=blue]
                > abc + "';\">");[/color]

                (And also, you should fully reference the input field, for greatest browser
                compatibility; e.g., document.formna me.text101.valu e)


                Comment

                • Jack

                  #9
                  Re: Why text100 can't be showed

                  This problem was solved.
                  I don't know jscript at all.I will study more.
                  Thank you for your help!

                  Comment

                  • Ray at

                    #10
                    Re: Why text100 can't be showed

                    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" <significance20 0310a@yahoo.co. jp> wrote in message
                    news:OSrwXtBqDH A.3612@TK2MSFTN GP11.phx.gbl...[color=blue]
                    > This problem was solved.
                    > I don't know jscript at all.I will study more.
                    > Thank you for your help!
                    >[/color]


                    Comment

                    Working...