0

Please help me!! What is wrong with my code??

<div id="pictureFrameDogodki">

                                            <div id="pictureMainDogodki1" style="display:none;">
                                                <img src="images/snowparty.jpg" alt="pa"/>
                                            </div>
                                            
                                            <div id="pictureMainDogodki2" style="display:block;">
                                                <img src="images/pokerturnir_zanet.jpg" alt="po" />
                                            </div>
                                            
                                            <div id="pictureMainDogodki3" style="display:none;">
                                                <img src="images/molella.jpg" alt="mo" />
                                            </div>
                                            
                                            <div id="pictureMainDogodki4"  style="display:none;">
                                                <img src="images/Inna.jpg" alt="in" />
                                            </div>  
                                            
                                            <div id="pictureMainDogodki5" style="display:none;">
                                                <img src="images/demosntracije.jpg" alt="d"/>
                                            </div>
                                            
                                        </div>
                                        <div id="frameDogodkiMeni">
                                        	<div class="frameGumb1">
                                            	<a class="gumbFrame" href="javascript:toggle('pictureMainDogodki5');" title="prva" onclick="toggle('pictureMainDogodki5');">5</a>
                                            </div>
                                            <div class="frameGumb">
                                            	<a class="gumbFrame" href="#" title="prva"  onclick="toggle('pictureMainDogodki4');">4</a>
                                            </div>
                                            <div class="frameGumb">
                                            	<a class="gumbFrame" href="#" title="prva"  onclick="toggle('pictureMainDogodki3');">3</a>
                                            </div>
                                            <div class="frameGumb">
                                            	<a class="gumbFrame" href="#" title="prva"  onclick="toggle('pictureMainDogodki2');">2</a>
                                            </div>
                                            <div class="frameGumb">
                                            	<a class="gumbFrame" href="#" title="prva"  onclick="toggle('pictureMainDogodki1');">1</a>
                                            </div>
                                        </div>


<script type="text/javascript">
    function toggle(id) {
        var state = document.getElementById(id).style.display;
            if (state == 'block') {
                document.getElementById(id).style.display = 'none';
            } else(state=='none') {
                document.getElementById(id).style.display = 'block';
            }
        }
</script>

Edited by Ezzaral: Added code tags. Please use them to format all code that you post.

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by loolek
0

else(state=='none') {
document.getElementById(id).style.display = 'block';
}

You don't need to put the expression into 'else' statement. Replace with below:

else {
document.getElementById(id).style.display = 'block';
}

Also, place the codes in code tags.

Edited by ko ko: Wrong syntax

This topic has been dead for over six months. 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.