tags:

views:

63

answers:

2
<a href="javascript:document.getElementById('create_table').style.display='block'">Insert Table</a>

The code works perfectly fine in Google Chrome but in Internet Explorer and Firefox it just redirects to a page with the text "block"

+4  A: 

Your qoutes are wrong:

javascript:document.getElementById('create_table').style.display=''block

It must be:

javascript:document.getElementById('create_table').style.display='block'

But you shouldn’t use javascript: pseudo-protocol anyway. Better use JavaScript to only enrich your document.

Gumbo
I fixed it, but it still didn't work
Ryan
+4  A: 

You should never use the javascript: pseudoprotocol. Use the click event for this. Besides, also watch the quotes.

Here's the correct approach:

<a href="#" onclick="document.getElementById('create_table').style.display='block'; return false;">Insert Table</a>

Note that I (optionally) returned false here to block the default action.

BalusC
Thanks, that worked
Ryan
You're welcome.
BalusC