sasha
09-13-2006, 07:53 PM
In administration interfaces for my sites I sometimes do things like this
<select onchange="roughMeUp(this)">
<option value="some value" attribute1="blah" rawdata="blah2">This is blah</option>
</select>
function roughMeUp() could look like this
function roughMeUp(obj){
var opt = obj.options[obj.selectedIndex]
alert (opt.getAttribute('attribute1') + ' ' +opt.getAttribute('rawdata') )
}
Now I am thinking about using this for public sites too. I am wondering if there is any good reason not to use custom attributes for HTML tags. Comments ?
<select onchange="roughMeUp(this)">
<option value="some value" attribute1="blah" rawdata="blah2">This is blah</option>
</select>
function roughMeUp() could look like this
function roughMeUp(obj){
var opt = obj.options[obj.selectedIndex]
alert (opt.getAttribute('attribute1') + ' ' +opt.getAttribute('rawdata') )
}
Now I am thinking about using this for public sites too. I am wondering if there is any good reason not to use custom attributes for HTML tags. Comments ?
