/ Published in: JavaScript
Expand |
Embed | Plain Text
window.onload = function(){ document.getElementById("randomButton").addEventListener('click', selectRandomOption, false); } function selectRandomOption() { var box = document.getElementById('s_box'); box.selectedIndex=box.length-1; box.selectedIndex=((Math.random()*box.length)-1); };
You need to login to post a comment.
