Jump to content
php.lv forumi
  • 0

Show hide abus


krisis32

Question

Sveiki! Noderētu palīdzība ar show hide.

<script type="text/javascript">
var x=1;
function toggle(elem) {
       if(x==0) { document.getElementById(elem).style.display = 'none'; x=1; }
       else { document.getElementById(elem).style.display = ''; x=0; };
};
</script>

 

<a href="#" onclick="toggle('showhide'); return false;">tabs1</a> 
<a href="#" onclick="toggle('showhide1'); return false;">tabs2</a>

<span style="display:none;" id="showhide">Pedeja Sacikstes tabulas te!</span>
<span style="display:none;" id="showhide1">Pedeja Sacikstes tabul1111as te!</span>

 

Viss strādā jauki, bet kā lai panāk to ka ja uzspiež uz abiem tabiem tad arī atver abus rezultātus, kas ir slēpti.

Un ja uzspiež uz kautvai tab1 tad viņš aizver pirmo tabu. Tiku galā ar to ka parāda abus ja uzspiež, bet tad nevar vairs aizvērt!

 

Sataisiju kā gribēju, bet tagad ir cita lieta. Kā lai uztaisa ka tab1 atveras uzreiz. Un ja uzspiež uz tab2 kamēr tab1 vaļā tad tab1 aizveras. Un otrādāk. (Uzpiež tab1 aizveras tab2)

Edited by krisis32
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...