locked
document.getElementById is strange RRS feed

  • Question

  • id="h_email" <form action="/"><input type="text" id="h_email" name="email" value="1"/></form><br/>
    id="email" <form action="/"><input type="text" id="email" name="email" value="2"/></form><br/>
    <input type="button" value="check" onclick="alert(document.getElementById('email').value)"/>
    

    Why in IE9 result is 1 ???
    Friday, June 24, 2011 10:55 AM

Answers

  • Thanks, problem is solved. I must use doctype )))

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    


    • Marked as answer by Yanping Wang Tuesday, June 28, 2011 3:11 AM
    Monday, June 27, 2011 5:52 AM

All replies

  • Hi,

    Do you have a web link to your full page source?

    We need to know the DTD you are using and what documentMode IE 9 is using?

    have you validated your full markup at validator.w3.org?

    Regards.


    Rob^_^
    Saturday, June 25, 2011 5:16 AM
  • Thanks, problem is solved. I must use doctype )))

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    


    • Marked as answer by Yanping Wang Tuesday, June 28, 2011 3:11 AM
    Monday, June 27, 2011 5:52 AM