JavaScript
HI
\\ recently started using html. here i have sections of work that i want hidden
\\ problem is that I can't figure a way to get the option and then show or hide stuff.
Again, I am starting out, so basic help please.
<script language="JavaScript" type="text/javascript">
function Display()
{
alert("you changed stuff");
var sel=0;
var sel = document.getElementById('Entry');
if (sel.options[sel.selectedIndex].value == "Day1")
{
alert("option 1");
document.getElementById("Day1").style.display="block";
document.getElementById("Day2").style.display="none";
}
else if(sel.options[sel.selectedIndex].value == "Day2")
{
alert("option2");
document.getElementById("Day1").style.display="none";
document.getElementById("Day2").style.display="block";
}
}
</script>
<select id="Entry" onchange="Display()" >
<option>--none--</option>
<option>Day1</option>
<option>Day2</option>
</select>
<div id="Day1" style="display: none;"> <br>Day1 </div>
<div id="Day2" style="display: none;"> <br>Day2</div>
http://jsfiddle.net/uKxEG/ it looks like your code works, just make sure that you did put that javascript in head
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks