0

Can someone please tell me why this code isn't working? I'm fiddling around with designing a site and trying to get my JS bearings down. I'm wondering why the second option isn't making the drop down list disappear. Thanks in advance!

<html>
<head>
</head>
    <script language="JavaScript">
        function fncShow()
        {
           document.getElementById('box').style.visibility = 'visible';
        	
        }
 
       function fncHide()
        {
            document.getElementById('box').style.visibility = 'hidden';
        	
        }
    </script>
     
<body>
 
    <select name="box">
    <option selected>Choose one</option>
    <option value="first" onclick="JavaScript:fncShow();">first option</option>
    <option value="second" onclick="JavaScript:fncHide();">second option</option>
    </select>
</body>
</html>
2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by genzoman
0

Line 1 - No document type?

Line 2 - You forgot to add <title>MyTitle</title> element

Line 4 to 16 - Your script needs to be either within the <head> or within the <body> tag

Line 20 - You did not add the id attribute:

<select name="box" id="box">

Line 21 - The correct syntax for having a option selected is selected="selected" (see reference)

~G

0

Line 1 - No document type?

Line 2 - You forgot to add <title>MyTitle</title> element

Line 4 to 16 - Your script needs to be either within the <head> or within the <body> tag

Line 20 - You did not add the id attribute:

<select name="box" id="box">

Line 21 - The correct syntax for having a option selected is selected="selected" (see reference)

~G

Gracias amigo!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.