PDA

View Full Version : Java Script Toggle text



Mehok
10-02-2006, 11:35 AM
Here is the script but it only shows the text after clicking i would like to see it slide or reviel it self after clicking like on http://www.ebuddy.com/mobile.php what can i do to make that happen

here is the script

Java:

<script language="javascript">
function toggle(targetId) {
target = document.all(targetId);
if (target.style.display == "none"){
target.style.display="";
} else {
target.style.display="none";
}
}
//-->
</script>


html:

<a href="javascript:toggle('Link1')">Link 1 </a>
<div id="Link1" style="display: none">

<div align="justify"><font color="#000000" size="2" face="Verdana">Here is the text you would like to show for Link 1.</font></div>
</div>
<br />
<a href="javascript:toggle('Link2','slide')">Link 2</a>
<div id="Link2" style="display: none">
<div align="justify"><font color="#000000" size="2" face="Verdana">Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script Java Script </font></div>

thanks in advance

tech_support
10-04-2006, 04:56 AM
Try: http://script.aculo.us/

Mehok
10-04-2006, 09:37 AM
not what i ment
if you go to www.ebuddy.com and go to the mobile section and click on a question it doesnot just apear from no where it gradually slides out from undernieth the question check it out for your self

tech_support
10-04-2006, 09:40 AM
Yes, it does do what you want it to do (with a bit of configuring)

But anyway, here's a more easier way:

http://www.dhtmlgoodies.com/index.html?whichScript=show_hide_content_slide

tech_support
10-04-2006, 10:38 AM
And also JavaScript not Java.

And it might be better if you change your code to this:



<script language="javascript">
function toggle(targetId) {
target = document.all(targetId);
if (target.style.display == "none"){
target.style.display="block";
} else {
target.style.display="none";
}
}
//-->
</script>

Mehok
10-04-2006, 01:19 PM
Thanks the code at http://www.dhtmlgoodies.com/index.ht..._content_slide helped me so much with a little coding to change it i could do with it


thanks very much