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 5 of 5

Thread: form problem

  1. #1
    New Coder
    Join Date
    Jan 2006
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    form problem

    this is a code i wrote just to check something that didnt seem to work in my site.

    when i press on the button i get an error: "object doesnt support this property or method".

    i've checked it without the form and it worked. but when i place the button inside the form it doesnt. i've tried to switch between get and post and other things but i'm probably missing something.

    <script>

    function aaa(num)
    {
    alert(num);
    }

    </script>


    <form name = "form1" action="" method="post">
    <input type="button" name="aaa" value="press" onClick="aaa('3')" />
    </form>

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,048
    Thanks
    0
    Thanked 251 Times in 247 Posts
    It seems like it doesn't like the method name aaa. I changed it to bbb (or even to aa or aaaa) and it worked. I don't know if aaa is a reserved word or not. It doesn't look like one but changing it worked.

  • #3
    New Coder
    Join Date
    Jan 2006
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    i dont belive it... i was about two murder my computer.
    thanks for saving it (and me)

  • #4
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    The problem is that you use the same name for the control as the function. Some browsers in some modes place element names as variable names in the global scope, thus overwriting functions and variables with the same names.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,048
    Thanks
    0
    Thanked 251 Times in 247 Posts
    Oopps, I didn't notice the button name was "aaa". How did I miss that.


  •  

    Posting Permissions

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