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
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts

    alternative to validation error with 'onChange'

    I have the following line in my html page. the validator throws an error on the onChange. what should I use instead?

    Code:
    <select name="combo0" id="combo_0" onChange="change(this);">
    This is my doctype.
    Code:
     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #2
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    Try to use small C:
    Code:
    <select name="combo0" id="combo_0" onchange="change(this);">
    In XHTML, attributes must all be in lowercase.

    Alternatively, you might want to separate the presentation from your markup.

    You might want to assign a function to that element via:
    Code:
    document.getElementById('combo_0').onchange=function(){
    change(this)
    }
    ...or:
    Code:
    var opt=document.getElementById('combo_0');
    opt.addEventListener?opt.addEventListener('change',function(){
    change(this);
    },false):opt.attachEvent('onchange',function(){
    change(this);
    }); // FF: IE
    Hope that helps.
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • Users who have thanked rangana for this post:

    oesxyl (01-18-2009)

  • #3
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    thank you rangana.

    validates now and works too.

    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link


  •  

    Posting Permissions

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