Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Javascript
DOM select onchange javascript
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="RobG, post: 4928745"] Presumably you want to know how to dynamically set an onchange handler using a function that requires parameters, so: object.onchange = function(){ someFunction(parm1, parm2); } Your next question will be 'how do I set the values of parm1 and parm2?'. object.onchange = function(){ someFunction('type1', 'item1'); } Is that what you want? You can do: object.onchange = function(){ var param1 = 'type1'; var param2 = 'item1'; someFunction(param1, param2); } That creates a closure (in this case a completely unnecessary one) back to the anonymous function, which may have complications. Please indent code with 2 (preferred) or 4 spaces and manually wrap at about 70 characters. Allow for a couple of quoted replies too. Where is optionTest declared or initialised? It doesn't seem to get used anyway. Where is formname initialised? Where was items initialised? [...] You are better to post an example or link that is a minimal example of what you are trying to do. Search the archives for 'dependent select options' or 'dynamic select list'. Try: <URL: [URL]http://www.javascripttoolbox.com/lib/dynamicoptionlist/[/URL] > [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Javascript
DOM select onchange javascript
Top