-4

I had create the following code

<script>
    function show()
    {
        document.getElementById("changetable").style.display = "initial";
    }
</script>
<script>
    function hide()
    {
        document.getElementById("changetable").style.display = "none";
    }
</script>
<select>
    <option onclick="hide()">1</option>
    <option onclick="hide()">2</option>
    <option onclick="hide()">3</option>
</select>
<input name="convert" id="submitbutton" type="button" value="Convert" size="10" onclick="return show();"/>
<div id="changetable" style="display:none" align="center">
    <table width="526" height="140" border="0" cellpadding="1" cellspacing="3">
        <tr>
            <th>
                name:
            </th>
            <td>
                <input name="fname" type="text" />
            </td>
        </tr>
    </table>
</div>

Everything is working fine, except when i using google chrome to display it. The table is shown, but it cant be hide after i click the option value. Mozilla and others is totally working fine. Any idea?

sevenseacat
  • 24,699
  • 6
  • 63
  • 88

1 Answers1

2

It would seem the show() function is not defined.

Meghan
  • 1,215
  • 11
  • 17
  • erm, it was my mistake, i edited the code, yet it still cant show. – kaitsukiyo Dec 09 '15 at 07:50
  • It seems events on the option tag are broken at the current moment https://stackoverflow.com/a/10058960/5203655 I updated a bin http://jsbin.com/motojanawu/edit?html,output – Meghan Dec 09 '15 at 08:03
  • @Sean They're not "broken", onclick events on options are not in the spec so they're not allowed. – JJJ Dec 09 '15 at 08:16