Jump to content

ID/Name


Matej

Recommended Posts

Hello there , i'd like to ask a question.

When there is

 

<input type="text" Id="GG" name="topic" value ="hi">

 

it is the same when i write

 

var x=document.getElementById("GG");                x.value

 

and

 

topic.value

?

Thanks for answers

Link to comment
Share on other sites

Well can you please explain why this doesnt work http://jsfiddle.net/35fQG/1/ (couldnt use forms)

and this does

 

    function nastav(typ) {        if (typ.value == "Zeleninový speciál") {            document.forms["pizzaFormular"].druh.value = "zelenina";        } else if (typ.value == "Masový speciál") {            document.forms["pizzaFormular"].druh.value = "maso";        } else if (typ.value == "Hawaii") {            document.forms["pizzaFormular"].druh.value = "sunkaAnanas";        }    }  <body><form id="pizzaFormular" action="#" onsubmit="return false;"><p> <input type="button" onclick="nastav(zelenSpecial)" name="zelenSpecial"    value="Zeleninový speciál"/><input type="button" onclick="nastav(masoSpecial)" name="masoSpecial"   value="Masový speciál" /><input type="button" onclick="nastav(hawaii)" name="hawaii"   value="Hawaii" />  </p><p>Druh pizzy: <select name="druh"><option value="syr" selected="selected">Sýrová</option><option value="zelenina">Zeleninová</option><option value="maso">S masem</option><option value="sunkaAnanas">Se šunkou a ananasem</option></select></p></form></body>  
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...