Jul 20, 2008

Toggle display in page script

Free Web Hosting, No Ads > Have your say > General Talk

free web hosting

Toggle display in page script

unimatrix0
This is my very first script, before I knew what was out there. It works in IE 5 and up. Not sure about netscape or mozilla. (I recently d/led mozilla and it's great for javascripts. Much less typing.)
CODE
<script language="javascript">

<!--

function toggle(what){

 if(document.all[what].style.display == "none"){

   document.all[what].style.display = "block";

 }else{

   document.all[what].style.display = "none";

 }

}

//-->

</script>

<a href="javascript:toggle('myDiv')">Toggle</a><br>

<div style="display:none;" id="myDiv">

 Some Text... Blah Blah Blah....

</div>


This is what I can remember.

 

 

 


Reply

sbibou
light & cool!!!
thanks... biggrin.gif

Reply

Meeko
Short and sweet. Nice simple code. I'll be using it. Thanks man. biggrin.gif

Reply

deheleri
Wow this is great for little help links and such, nice!

Reply

chakhei
Short and clean... thanks

Reply

Scotty Walds
That is pretty cool... might use it thanks

Reply

God
document.all is a IE only DOM. Use this for the cross-browser version. I just changed the way to get the element.
CODE
<script language="javascript">

<!--

function toggle(what){

 if(document.geElementById(what).style.display == "none"){

   document.getElementById(what).style.display = "block";

 }else{

   document.getElementById(what).style.display = "none";

 }

}

//-->

</script>


Use the same link/div.

Reply

iGuest
There is a shorter script to do that:
[code]
Function toggleId(id) {
element = document.GetElementById(id);
modus = (element.Style.Display == 'none' || element.Style.Display == '') ? 'block' : 'none';
element.Style.Display = modus;
}
[/code]

Reply

iGuest
Help with code
Toggle display in page script

Replying to unimatrix0

Hi,

I have used your code but found that I am unable to use it more than once on my web page. I have a few headings for which I want the text below it to appear and disappear.. I just copied and pasted the code a few times and changed the words but found it wasnt working.

How can I use the code given so that I can have a few headings on the page which will have different text appear and disappear?

Thanks for help.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Recent Queries:-
  1. toggledisplay - 5.76 hr back. (1)
  2. javascript toggle display - 13.99 hr back. (1)
  3. toggle scripts with php - 52.04 hr back. (1)
Similar Topics

Keywords : toggle, display, page, script

  1. Display 'from Ip Address' On Web Page
    PHP Code Help (9)
  2. Can You Use A Login Script To Login To Forums
    from outside of the forum itself? (3)
    The title and description of this topic should tell you my basic question, but it's never enough
    detail just to read a question, so I will explain my intention. Basically, on my website I have a
    php script for users to register to my site. I then use this data to create forum accounts (I do not
    use the main forum Registration form because I cannot change it's contents and there are some
    questions I'd like to ask before registration). Later I also plan to make hidden areas that you
    need to register for to enter. Anyway, I wondered if it was possible to make ....
  3. Convert Decimal Days
    a little PHP script (5)
    I wrote a little PHP script that converts decimal days to an easier format: For instance, 9.13 days
    (coincidentally my remaining days /tongue.gif' border='0' style='vertical-align:middle'
    alt='tongue.gif' /> ) = 9 days, 3 hours and 7 minutes
    http://usmleportal.trap17.com/convert_date.php Have fun /laugh.gif' border='0'
    style='vertical-align:middle' alt='laugh.gif' /> ....
  4. A script!
    (4)
    I begin in php and i search a script : when i click next that's have the next pic ... when I click
    prev that's show the previous picture! Do tou know if i can make it in javascript or it is just
    in php ?? :roll: :oops:....
  5. Display pic
    (4)
    HOW?....
  6. I want to display only one category on index
    (3)
    Please someone tell me what modifications do I have to do to make my forum starting page looking
    something like this: http://www.freenukehosting.com/forums/index.php?c=1 My forum is a
    php-nuke module ! Thx /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' />
    ....
  7. Email Script
    (2)
    I need ascript so my users can log in to email through squirrel mail.....
  8. no name script
    (1)
    i use no named scriped on mirc its realy handy like for kicking people and ban filters on my chanels
    it acs like a body gard heh :twisted....
  9. A Script Required
    (1)
    I need a help.... most of the sites usinga php script...to hide the orginal link source the php
    script is like that :: www.yourdomain.com/hosting.php?review=84 i want this
    script............can any 1 help ???????? /sad.gif' border='0' style='vertical-align:middle'
    alt='sad.gif' /> ....
  10. REQUEST FORM SCRIPT NEEDED
    (2)
    i have a radio station yeah. and i would like a script where you have a form and when the user fills
    in the form its saved into a mini database. anybody have a script of this type if you get what i
    mean....
  11. Script Shop
    (0)
    Due to the new mod here on FNH, which allows other people to give me FNH$, I will be opening a
    scripting shop. Here, you can get me to write you scripts in exchange for FNH$. There aren't any
    set prices, at least for a while. We can discuss them. I can script in these languages:
    PHP/MySQL-Pretty skilled, I could write an entire website for you. Javascript- Very skilled, I
    can do anything in this. /biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif'
    /> CSS-Perfectly fine with this. I use it if I'm doing any HTML. (X)HTML-I'm good wit....
  12. i need a database backup and restore script please
    (0)
    hi i need a database backup and restore script please if any one can help me please i tested
    alot of scripts but no one worked good so if anyone have a good tested script i will be thankful
    for him :wink:....
  13. I need listing script with rate program
    (2)
    I try to find free listing script complete with rate program. It will be good if it is integrate
    with CMS program. I'm usually using Mambo CMS for my work.....
  14. Ladder Script
    (10)
    Does anyone know where u can find these types of scripts without buying them, cuz i can't find any
    at all if there is a website i can go to download them for free or could yall just contact me or
    something if u know or just post it in the forums on this thread.thank you.....
  15. Gmail Signature Script
    (11)
    You can make Gmail Singature Demo : http://playtime.uni.cc/gmail.php Download Script :
    http://playtime.uni.cc/downloads/dl.php?file=gmail.zip Good luck to you....
  16. picture display
    (5)
    What would you say is the best method of displaying pictures? I have 'preview' samples of my
    pictures, that i want to use as thumbnails. So when you click the small thumbnail it will show you
    the full size pic. That is easy to upadte (add more pics) I have a few ideas but i was wondering if
    anyone could suggest their prefered method of doing this. I have dreamweaver also. Thanx....
  17. My mIRC script page..
    (5)
    Hi there.. this is my page... it's kinda diary, and my mIRC scripting presentation... so, I would
    like to hear your opinion.. /smile.gif' border='0' style='vertical-align:middle'
    alt='smile.gif' /> http://www.uptheirons.co.sr/ ....
  18. looking for a script..............
    (2)
    I am looking for a script that let me have an list of url's, an everytime I press a link the the
    next link will be active. So everytime ! pres the button another link wil be under it. Like
    this: 1st click ++Butten++ --->> www.zawel.com/link1 2th click ++Butten++ --->>
    www.zawel.com/link2 www.zawel.com/link1 www.zawel.com/link2 www.zawel.com/link3
    www.zawel.com/link4 www.zawel.com/link5 And That I can make a list in any sequence I want.
    Hope somone knows what I mean, and can halp me :wink:....
  19. need script
    (3)
    i need a quick reply script for my forums of phpBB any one here tellme from where i'll get it and
    install it....
  20. Mouse-Over Image Script
    (1)
    Hi, Im looking for a mouse-over script that doesnt require you to make 2 seperate images, as that
    would take time if one has a lot of pics.. But i've found a good script that makes links blur or
    pixelate, as a internet effect using the style.css. But its not wat im after, im looking for a
    mouse-over script like the blur effect but only on image links, not text links. Are there any out
    there... Thnx.....
  21. LoginAnywhere (Script for phpbb)
    (1)
    A html or php login script that allows you to add a login on an index page or somewhere that logs
    you into a phpbb forum. very useful. http://phpbbhacks.com/download/1839 ....
  22. IRC Script with auto say again
    (1)
    I'm looking for a MIRC script that automatic resay that I have said if the person doesn't answer to
    me and only if the person doesn't answer. Example ! me> Hello ! 2 minutes later Resay #1 :
    Hello ! 2 minutes later Resay #2 : Hello ! 2 minutes later Resay #3 : Hello ! The person>
    how are you ! Stop resay ....
  23. Free Weather Feed Script
    (1)
    If you are tired of providing your clients with weather feeds that take visitors off of their site
    or slam their site with ads, I finally found one after searching for hours. Here's a link to a
    FREE php script that pulls the feed directly from any airport in the world to your site. It is easy
    to customize and has simple, well documented installation instructions.
    http://www.mattsscripts.co.uk/mweather.htm hope you find it helpful... a good one for designers
    to archive as you will most likely need it some day for a client. Check out Matt's other free
    scripts....
  24. SMS Script
    (4)
    Hi Friends Please any one send me Java Scripts for International SMS. Regards Zaidi....
  25. will give free auction script
    (1)
    hi, i will be soon giving free auction script and marketting tools for sign up on codezila.com( its
    down now but u can check my site it on http://codezila.tk ) the demo of auction software is
    loaded on http://samiiir.thefreebizhost.com so watch out....
  26. i need sms script
    (7)
    hello can anyone give me send SMS script?....
  27. Script Sites
    (13)
    Post any script sites you know here. There should be a pretty long list I would hope .
    www.hotscripts.com....
  28. A login Script
    (7)
    I would like a script where people can login into my site and be able to see pages that guest's
    cannot see. like Yahoo's webmail. but except i want them to be able to register and be able to login
    to see the secret page that normal people can't, and also if the guest try to see it, they get an
    error, please login... yes my pages are in php.......
  29. Script Request
    (6)
    I am looking for a script in php. The script i need is for a contest thing. I need it to check for
    the person to see if he is logged in. Then They can upload an image a certain size. And it is put in
    a folder for me to check. Any kind of script with that stuff.....
  30. MIRC script by me.
    (4)
    I made this script check it out and tell me what you think. CODE
    http://kietekas.com/kietekasscriptas.rar ....

    1. Looking for toggle, display, page, script

Searching Video's for toggle, display, page, script
advertisement



Toggle display in page script



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE