IDs & NAMEs

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

IDs & NAMEs

Post by Gen-ik »

Could someone please explain what difference JavaScript sees between ID and NAME tags.

example: <div id="thediv" name="bob">

Thanks.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

pistolfire99
Forum Commoner
Posts: 58
Joined: Thu May 23, 2002 3:18 pm

Post by pistolfire99 »

My suggestion, always use ID tags in ur forms if u are going to use php + javascript + html. Without ID's, it was just like hell to pass variables between pages for me...
Oh well...
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

:?: I doubt the value of an element without name is transmitted.

Code: Select all

<html><body>
<pre><?php print_r($_POST); ?></pre>

<form method="POST">
	<input type="input" name="withName" />:name only<br />
	<input type="input" id="onlyId" />:id only<br />
	<input type="input" name="theName" id="theId"/>: name & id<br />
	<input type="submit" />
</form>
</body></html>
But probably I misunderstood something ;)
Post Reply