andleer
andleer

Reputation: 22568

Javascript in IE vs Firefox

The following script works fine in IE7 but fails to execute in Firefox 3. The div tag which was display: none; shows in IE but never in FF. I am not a client / javascript guy... thanks.

<script type="text/javascript">
//<![CDATA[
document.getElementById("Fred1_Panel").style.setAttribute("display","inline");//]]>

</script>

Upvotes: 0

Views: 519

Answers (4)

collimarco
collimarco

Reputation: 35400

This code should work:

document.getElementById("Fred1_Panel").style.display = "inline";

In general if you encounter problems in Firefox you can easily discover the exact problem (and maybe find out the solution) using Firebug plugin or simply seeing at the Error console.

Upvotes: 1

Richard
Richard

Reputation: 109005

In FF, starting with either Tools | Error Console, or FireBug's console is a good way to see what errors are occurring.

Upvotes: 2

REA_ANDREW
REA_ANDREW

Reputation: 10764

try this:

document.getElementById("Fred1_Panel").style.display = '';

OR

document.getElementById("Fred1_Panel").style.display = 'inline';

Upvotes: 6

Kenan Banks
Kenan Banks

Reputation: 211982

This will work in both browsers:

document.getElementById("Fred1_Panel").style.display = 'inline';

Upvotes: 4

Related Questions