Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
JS function do not work on IE ?
Old 09-14-2008, 01:00 AM JS function do not work on IE ?
Junior Talker

Posts: 2
Trades: 0
Hi,

First, here is the code :

Function :

Code:
var isDisplayed=false;
function show() 
{
    if (isDisplayed)
    {
           isDisplayed = false;
           document.getElementById("livre_or").style.display = "none";
        document.getElementById("livre_or_2").style.display = "none";
     }
    else
    {
           isDisplayed = true;
           document.getElementById("livre_or").style.display = "inherit";
        document.getElementById("livre_or_2").style.display = "inherit";
        document.getElementById("livre_or_a").style.display = "none";
    }

}
And here, my page :

Code:
<h2>
    Livre d'or
</h2>

<div class="contenu_center" id="livre_or" style="display: none;">
<div class="contenu_center">
        <form action="livre_or_proceed.php" method="post">
    Nom: <br />
    <input type="text" size="30" name="nom" value="" /><br />
    Message: <br />
    <textarea name="message" cols="60" rows="5"></textarea><br />
    Code de confirmation: <br />
    <input type="text" size="15" name="code" /><br />
    <img src="code-de-verification.png" title="Code de vérification" />
    <input type="hidden" value="96.21.63.176" name="ip" /><br />
    <input type="submit" value="Envoyer" />
    </form>
</div>
</div>

<h2 id="livre_or_2" style="display: none;">
    Commentaires
</h2>
<div class="contenu_center">
        <div class="centered">
        <a href="livre-d-or/#" onclick="show()" id="livre_or_a" style="display: inherit;"><span class="gros">Sign the guest book!</span></a>
</div>
It's not all my page, but the part that we need.

On Firefox and others, when I click on "sign guest book", it makes my div appear. No problems there. But when I am on IE, clicking on the link do nothing ... Why ?

Thanks,

Sam

PS : sorry, the code is in french, but I'm sure you can deal with it
sam_1421 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-14-2008, 07:47 AM Re: JS function do not work on IE ?
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Try to replace the "inherit" with "block". I'm not sure if IE recognize this as a valid value to set via javascript.

Otherwise, it may not be that, but I like my conditions to be explicit, so I would have written it:
Code:
if(isDisplayed==true){
  ....
}
else{
  ....
}
I don't see nothing otherwise that would prevent it to work.
Does IE gives you an error message, or does it just "don't work" without error ?

Oh, and by the way, welcome to the forum.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 09-14-2008, 02:37 PM Re: JS function do not work on IE ?
Junior Talker

Posts: 2
Trades: 0
Oh thanks ! That was it ! IE didn't recognize the property "inherit", so it would not display !! I replaced style.display="inherit" by style.display='', and it worked ! Many thanks

Sam
sam_1421 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to JS function do not work on IE ?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.50286 seconds with 12 queries