Original link: http://bbs.51cto.com/thread-1098421-1-1.html
The target handler function is selectattr (test)
1. Pass the given parameters directly such as:
onclick="selectattr (' 1 '); onclick="selectattr (' a ');
2. Passing a property value
<input type="text" id="nameId" name= " TypeName">onclick="selectattr (typename.value); onclick="selectattr (nameid.value);
3. Passing the This object
onclick="selectattr (this);
Get the corresponding option value through this object: This.value or this.name;
If you are a custom property, you can get it in the following ways:
Document Method gets:
var divs=document.getelementbyid ("typeName1"); var x=divs.getattribute ("code");
Code is a custom attribute.
Jqery Way to obtain:
$ ("#typeName"). attr ("value"); var typename=$ ("#sel"). Find ("option:selected "). attr ("code");
HTML passing parameters to JS one via event