I want to look through the document and find all the <select> elements and then for each one of those return the value of the option that has been selected with each one of those selects.
Here is what I have so far:
[code=html]<html>
<head>
<title></title>
</head>
<body>
<div id=”abbr_markup_div”>
I am going to visit the <select name=”selectFormAbbr”><option value=”US”>US</option><option value='<abbr title=”United States”>US</abbr>’>United States</option></select>, with all the rest of us in a big party of <select name=”selectFormAbbr”><option value=”DSc”>DSc</option><option value='<abbr title=”Doctor of Science”>DSc</abbr>’>Doctor of Science</option></select> holders. The US can also be written as <select name=”selectFormAbbr”><option value=”USA”>USA</option><option value='<abbr title=”United States of America”>USA</abbr>’>United States of America</option></select> or U.S.A, in case you are interested in that uninteresting fact.
Then I will write some <abbr title=”css”><select name=”selectFormAbbr”><option value=”CSS”>CSS</option><option value='<abbr title=”Cascading Style Sheets”>CSS</abbr>’>Cascading Style Sheets</option></select></abbr> stylesh<select name=”selectFormAbbr”><option value=”ee”>ee</option><option value='<abbr title=”er enghraifft”>ee</abbr>’>er enghraifft</option></select>ts, and write some crappy non-<select name=”selectFormAbbr”><option value=”W3C”>W3C</option><option value='<abbr title=”World Wide Web Consortium”>W3C</abbr>’>World Wide Web Consortium</option></select> compliant <select name=”selectFormAbbr”><option value=”HTML”>HTML</option><option value='<abbr title=”HyperText Markup Language”>HTML</abbr>’>HyperText Markup Language</option></select>.
<select name=”selectFormAbbr”><option value=”NASA”>NASA</option><option value='<abbr title=”National Aeronautics and Space Administration”>NASA</abbr>’>National Aeronautics and Space Administration</option></select> <select name=”selectFormAbbr”><option value=”UK”>UK</option><option value='<abbr title=”United Kingdom”>UK</abbr>’>United Kingdom</option></select> <select name=”selectFormAbbr”><option value=”IS”>IS</option><option value='<abbr title=”Information Services”>IS</abbr>’>Information Services</option></select> <select name=”selectFormAbbr”><option value=”PCA”>PCA</option><option value='<abbr title=”Prifysgol Cymru, Aberystwyth”>PCA</abbr>’>Prifysgol Cymru, Aberystwyth</option></select> <select name=”selectFormAbbr”><option value=”AM”>AM</option><option value='<abbr title=”Ante Meridium”>AM</abbr>’>Ante Meridium</option></select> <select name=”selectFormAbbr”><option value=”PM”>PM</option><option value='<abbr title=”Post Meridium”>PM</abbr>’>Post Meridium</option></select>, Then I will ring the <select name=”selectFormAbbr”><option value=”CQFW”>CQFW</option><option value='<abbr title=”Credit and Qualifications Framework for Wales”>CQFW</abbr>’>Credit and Qualifications Framework for Wales</option></select>, for no particular reason. Eg, just for the <b>great</b> fun that it is.
</div>
<button onclick=”change_abbr()”>Change</button>
<script type=”text/javascript”>
function change_abbr()
{
abbrDiv = document.getElementById(“abbr_markup_div”);
items = abbrDiv.getElementsByTagName(“select”);
for(i=0;i<items.length;i++)
{
}
}
</script>
</body>
</html>
So for each of those selects I want to return the value of the option that is selected. Any help please?