toggle .value property ?

Discussion in 'Javascript' started by Jürgen Heyn, Feb 13, 2004.

  1. Jürgen Heyn

    Jürgen Heyn Guest

    Good morning,

    on form 2 input elements and 1 image are placed. The 1st (Index[0]) one is
    "hidden", the 2nd [Index[1]) is an empty textbox.
    When clicking the picture I would like to toogle a boolean value. (displayed
    in the textbox).
    The following function reacts correctly on the first click. Any further
    click as no effect (is returns "TRUE" in the textbox).
    Where is the mistake ? How can I solve the problem ?
    Thank you very much in advance.
    Best regards
    Juergen Heyn, Wilhelmshaven, Germany

    <script language="JavaScript">

    function toggle()

    // -->


    <form action="">
    <input type="hidden" name="YesNo" value="yes">
    <input type="text" name="Textbox" size="20">
    <a href="#" onClick=toggle()>
    <img src="Button.gif" border="0" width="36" height="36">

    Jürgen Heyn, Feb 13, 2004
    1. Advertisements

  2. Jürgen Heyn

    Ivo Guest

    I suppose you mean
    with double "="
    Also note that "TRUE" between quotes is not a boolean, but a string.
    Ivo, Feb 13, 2004
    1. Advertisements

  3. Jürgen Heyn

    Jürgen Heyn Guest

    Hi Ivo,

    Thank you very much for the hint. This was actually my mistake.
    Coming from Visual Basic the double "==" was unknown.
    Thanks again !

    Jürgen Heyn, Feb 13, 2004
  4. Considering that the value property of form controls is of type string, do
    you really think it matters much?

    Michael Winter, Feb 13, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.