|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
getElementByIdHello! I have an HTML page from which I'd like to read username data and url to my javascript, for example: ... <form name="podatki> <input name="uname" id="uname" value="user1" type="hidden"></input> <input url="url" id="url" value="http://www.mochikit.com" type="hidden"></input> </form> <a href="#" onClick="jscript()">link</a> .... in jscript.js the code is: function jscript() { uname=document.geElementById("uname"); url=document.getElementById("url"); log(uname); log(url); } I expected to get from log user1 and http://www.mochikit.com, but I got [object HTMLInputElement] I guess that is correct but how to get data from HTML page?? Hope I was clear with the question. Boštjan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "MochiKit" group. To post to this group, send email to mochikit@... To unsubscribe from this group, send email to mochikit+unsubscribe@... For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: getElementByIdvar url = document.getElementById("url").value; but if you're using MochiKit, you could shorten it to: var url = $("url").value; -- troels 2009/1/25 Boštjan Jerko <mlist@...>: > > Hello! > > I have an HTML page from which I'd like to read username data and url > to my javascript, for example: > > ... > <form name="podatki> > <input name="uname" id="uname" value="user1" type="hidden"></input> > <input url="url" id="url" value="http://www.mochikit.com" > type="hidden"></input> > </form> > <a href="#" onClick="jscript()">link</a> > .... > > in jscript.js the code is: > > function jscript() > { > uname=document.geElementById("uname"); > url=document.getElementById("url"); > log(uname); > log(url); > } > > I expected to get from log user1 and http://www.mochikit.com, but I got > > [object HTMLInputElement] > > I guess that is correct but how to get data from HTML page?? > > Hope I was clear with the question. > > Boštjan > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "MochiKit" group. To post to this group, send email to mochikit@... To unsubscribe from this group, send email to mochikit+unsubscribe@... For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~----------~----~----~----~------~----~------~--~--- |
| Free embeddable forum powered by Nabble | Forum Help |