Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Sep 2002
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Please Help using checkbox onclick event

    HI:

    Can someone tell me what's wrong with this simple code.
    All I want is to chang the value of the submit button when I click on the check box. I call a function which is changing the submit button value.


    Thanks for your help in advance.

    <html>
    <head>
    <title>Tabbed Interface Sample</title>

    <script language="javascript">


    function addcnt()
    {

    document.frmedi214d.cmdContinue.value="Hello";
    }

    </script>
    </head>

    <body bgColor="lightgrey" );">
    <FORM name ='frmedi214d' action='../../nsc1/showformdata.asp' method=post>


    <Input type="checkbox" name="accept1" value="1" onFocus="addcnt"> </INPUT>


    You have Accepted <INPUT type="button" name="cmdContinue" value="0 Orders" onclick="funSubmit()"> Please Click after viewing all P.O </INPUT>
    </FORM>
    </BODY>
    </HTML>

  • #2
    Owl
    Owl is offline
    New Coder
    Join Date
    Jun 2002
    Posts
    62
    Thanks
    0
    Thanked 1 Time in 1 Post
    Hi javaspace,

    ... onFocus="addcnt()">

    ( •) (• )
    >>V

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    input tags are self-closing tags, meaning there should be no closing tag

    <INPUT type="button" name="cmdContinue" value="0 Orders" onclick="funSubmit()"> Please Click after viewing all P.O </INPUT>

    if you want it to be XHTML compatible, you have to use />

    <input type="button" name="cmdContinue" value="0 Orders" onclick="funSubmit()" />

    and you should use onclick in the checkbox instead of onfocus and simplify it like this:

    <input type="checkbox" name="accept1" value="1" onclick="this.form.cmdContinue.value='Hello'">

    This will change 0 Orders to Hello. Is this what you really wanted? I suspect what you were trying to change is the text Please Click after viewing all P.O
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •