Text input value equal to a variable

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

    Text input value equal to a variable

    Is there a way to have a text input field equal some variable value so that it
    changes if that variable changes? It does not have to by dynamic.

    <INPUT TYPE="TEXT" NAME="hW" size="4" value=some variable>

    Thanks,
    Jeff


  • gf

    #2
    Re: Text input value equal to a variable

    "JeffFinnan " <jefffinnan@aol .com> wrote in message
    news:2004013116 2035.28446.0000 1144@mb-m15.aol.com...[color=blue]
    > Is there a way to have a text input field equal some variable value so[/color]
    that it[color=blue]
    > changes if that variable changes? It does not have to by dynamic.
    >
    > <INPUT TYPE="TEXT" NAME="hW" size="4" value=some variable>
    >
    > Thanks,
    > Jeff
    >
    >[/color]


    This will place the value of Field1 into Field2 as soon as Field1 loses its
    focus

    <form name='myform1'>
    Field1: <input name='f1' onChange='docum ent.myform1.f2. value=this.valu e'>
    <br /><br />
    Field2: <input name='f2'>
    </form>

    or

    <form name='myform2'>
    Field1: <input name='f1'>
    <br /><br />
    Field2: <input name='f2' onFocus='this.v alue=document.m yform2.f1.value '>
    </form>



    Comment

    • Lee

      #3
      Re: Text input value equal to a variable

      JeffFinnan said:[color=blue]
      >
      >Is there a way to have a text input field equal some variable value so that it
      >changes if that variable changes? It does not have to by dynamic.[/color]

      You want it to change if the variable changes, but it doesn't have
      to be dynamic? You're not being clear. What is it that you're
      trying to do?

      Comment

      • JeffFinnan

        #4
        Re: Text input value equal to a variable

        >You want it to change if the variable changes, but it doesn't have[color=blue]
        >to be dynamic? You're not being clear. What is it that you're
        >trying to do?
        >
        >[/color]

        ==============
        I have a frame load with a default value for a parameter that is use for sizing
        a plugin (Chime). I then want to have a input box show this default value but
        then allow a new number to be put in so that when the frame is reloaded, the
        plugin has this new value and the new value is shown in the input box. I looked
        at what gfraley5@earthl ink.net had written. I got it to do the above with

        =============== ==============
        <form name=form2>
        <input type=button onClick="resetF ile()" value="Reset/Reload">
        &nbsp;&nbsp;&nb sp; Height and Width of Chime window=
        <INPUT NAME="hW" size="6" onFocus='this.v alue=parent.upp er.heightWidth' >

        </form>
        <SCRIPT LANGUAGE=JAVASC RIPT>
        document.form2. hW.focus();
        </SCRIPT>
        =============== ==============

        The statement, document.form2. hW.focus();, makes the number (default or new)
        appear in the box when the page loads or reloads.

        If there is a better way, let me know.

        Thanks,
        Jeff


        Comment

        • JeffFinnan

          #5
          Re: Text input value equal to a variable

          =============== ==============
          <form name=form2>
          <input type=button onClick="resetF ile()" value="Reset/Reload">
          Height and Width of Chime window=
          <INPUT NAME="hW" size="6" onFocus='this.v alue=parent.upp er.heightWidth' >

          </form>
          <SCRIPT LANGUAGE=JAVASC RIPT>
          document.form2. hW.focus();
          </SCRIPT>
          =============== ==============
          This works fine in IExplorer. I was just checking Netscape 4.8 and I notice the
          new value of hW goes back to the default, not the new number.

          setFile() is in an external js file. The function is

          function resetFile() {
          parent.upper.he ightWidth = parent.viewer.d ocument.form2.h W.value;
          parent.viewer.d ocument.locatio n.href = "chimeviewer.ht ml"

          }

          Comment

          • JeffFinnan

            #6
            Re: Text input value equal to a variable

            >============== ===============[color=blue]
            ><form name=form2>
            > <input type=button onClick="resetF ile()" value="Reset/Reload">
            > Height and Width of Chime window=
            > <INPUT NAME="hW" size="6"[/color]
            onFocus='this.v alue=parent.upp er.heightWidth' >[color=blue]
            >
            ></form>
            ><SCRIPT LANGUAGE=JAVASC RIPT>
            >document.form2 .hW.focus();
            ></SCRIPT>
            >============== ===============
            >This works fine in IExplorer. I was just checking Netscape 4.8 and I notice
            >the
            >new value of hW goes back to the default, not the new number.
            >[/color]

            Actually, I was just rechecking and I notice that anytime I click on the page
            the value of hW always goes back to the default in Netscape 4.8.


            Comment

            Working...