Parašė ire· 2012 Spa. 14 02:10:14
<!DOCTYPE <span style="border-bottom: 1px dotted black;">html</span> PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title></title>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js' type='text/javascript'></script>
<script type='text/javascript'>
$(document).ready(function() {
});
// Event Handler for the OnChange event of the Select1
function SelectedItemChanged() {
// Gets the value of Select1
var x = $('select#Select1').val();
// Ensures that the corresponding paragraph is visible
HideItem(x);
// Loops through all of the options for Select1 and hides them if they aren’t the selected option
$('select#Select1 option').each(function(i) {
if ($(this).val() != x) {
ShowItem($(this).val());
}
});
}
function ShowItem(alpha) {
$('#changingArea #' + alpha).show();
}
function HideItem(alpha) {
$('#changingArea #' + alpha).hide();
}
</script>
</head>
<body>
<select id='Select1' name='Select1' onchange='javascriptelectedItemChanged();'>
<option>A</option>
<option>B</option>
<option>C</option>
<option>D</option>
<option>E</option>
</select>
<div id='changingArea'>
<div id='A'>Paragraph 1</div>
<div id='B'>Paragraph 2</div>
<div id='C'>Paragraph 3</div>
<div id='D'>Paragraph 4</div>
<div id='E'>Paragraph 5</div>
</div>
</body>
</html>