Code does not seem to do what it should

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sheelpatel@gmail.com

    Code does not seem to do what it should

    I am currently using php to output the javascript and was just
    wondering if my syntax was correct as the code does not seem to work

    <form action="" method="post" name="myform">
    <input name="test" type="text" />
    <input name="test2" type="text" onclick="docume nt.myform.test2 .value =
    document.myform .test.value" />
    <input name="test3" type="text" />
    <input name="test4" type="text" onclick="if
    (document.myfor m.test4.value == document.myform .test3.value) {
    document.getEle mentById(a).inn erHTML='Some Text'}" /> <div id="a"> bob
    </div>

    </form>

    is part of what the php outputs, and the specific section I am having a
    problem with is the onclick section of test4 any help would be greatly
    appreciated, Thankyou

  • Jim Land

    #2
    Re: Code does not seem to do what it should

    sheelpatel@gmai l.com wrote in news:1150431182 .452515.111770
    @p79g2000cwp.go oglegroups.com:
    [color=blue]
    > I am currently using php to output the javascript and was just
    > wondering if my syntax was correct as the code does not seem to work
    >
    > <form action="" method="post" name="myform">
    > <input name="test" type="text" />
    > <input name="test2" type="text" onclick="docume nt.myform.test2 .value =
    > document.myform .test.value" />
    > <input name="test3" type="text" />
    > <input name="test4" type="text" onclick="if
    > (document.myfor m.test4.value == document.myform .test3.value) {
    > document.getEle mentById(a).inn erHTML='Some Text'}" /> <div id="a"> bob
    > </div>
    >
    > </form>
    >
    > is part of what the php outputs, and the specific section I am having a
    > problem with is the onclick section of test4 any help would be greatly
    > appreciated, Thankyou
    >
    >[/color]

    Just put single-quotes around the "a":
    document.getEle mentById('a')

    Your code now works in IE and Firefox.

    Comment

    • sheelpatel@gmail.com

      #3
      Re: Code does not seem to do what it should

      Those small mistakes get me every time, thankyou for your help.

      Comment

      Working...