JamesManke
Programmer
Is there a way to have javascript change the selected item in
a select box without refreshing the page.
Thanks
a select box without refreshing the page.
Thanks
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<html>
<head><title>media types</title>
<script language="javascript">
function doit() {
var oelem=document.getElementById("mediatype");
oelem.selectedIndex=parseInt(Math.random()*(oelem.length-1))+1;
}
</script>
</head>
<body>
<form>
<select id="mediatype" name="mediatype">
<option value="empty">Choose Media Type</option>
<option value="Text/xml">Text/xml</option>
<option value="Application/xml">Application/xml</option>
<option value="Text/xml-external-parsed-entity">Text/xml-external-parsed-entity</option>
<option value="Application/xml-external-parsed-entity">Application/xml-external-parsed-entity</option>
<option value="Application/xml-dtd">Application/xml-dtd</option>
</select>
</form>
<hr />
<button name="btntest" onclick="doit()">random change Media Type selection</button>
</body>
</html>