View Single Post
Old 01-10-2013, 07:45 AM   PM User | #2
sbhmf
New Coder

 
Join Date: Jan 2013
Location: Sunnyvale, CA
Posts: 40
Thanks: 3
Thanked 1 Time in 1 Post
sbhmf is an unknown quantity at this point
your code is illegal: two controls may not possess the same value for their id attribute, as all IDs must remain unique within the document.

if you must, use the name attribute to group controls, as it does not need to be unique.

what you want to do is certainly possible, but not necessary, as you may accomplish the same by passing 'this', as in '...onclick="SubtractOne(this)" ', where the entire tag itself is passed to the javascript function. the function may then retrieve the id from the object itself. Observe:

function SubtractOne(Caller){
alert( "the caller's id is " + Caller.getAttribute('id') );
}
sbhmf is offline   Reply With Quote
Users who have thanked sbhmf for this post:
juliushg (01-10-2013)