问题
I am trying to load a URL when a drop down menu changes via YUI Change event. I just want to navigate to that URL.
I made a long search. But didn't got any way.
Thanks :)
回答1:
<select id="dropdown">
<option value="http://example.com/home">Home</option>
<option value="http://example.com/about">Abount</option>
</select>
Y.one("#dropdown").on("change", function() {
//'this' points to dropdown node
//so it's value is a value of selected option. Assume you keep new url there
document.location.href = this.get('value');
});
来源:https://stackoverflow.com/questions/18490592/loading-a-url-when-dropdown-option-changes-in-yui