User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 375,232 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,181 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 4369 | Replies: 2
Reply
Join Date: Oct 2007
Posts: 6
Reputation: buggsword is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
buggsword buggsword is offline Offline
Newbie Poster

Toggle div visibility

  #1  
Oct 7th, 2007
Hello,
I am new to javascript and am aware that this topic is well documented, but not in the way I need the script to work?

I am able to show/ hide a div using the the following:

function toggleMe(a){
var e=document.getElementById(a);
if(!e)return true;
if(e.style.display=="none"){
e.style.display="block"
} else {
e.style.display="none"
}
return true;
}

With a link using:
<a href="#" onClick="return toggleMe('flashOverlay')">Info</a>

The problem I have is that I need to toggle this script with a link in Flash MX, which will not allow me to use "onClick=". Is it possible to have the div show/hide via <a href></a> only?

Thanks in advance
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jan 2007
Posts: 2,433
Reputation: MidiMagic is on a distinguished road 
Rep Power: 6
Solved Threads: 99
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Nearly a Posting Maven

Re: Toggle div visibility

  #2  
Oct 8th, 2007
Not in the usual sense.

You could have two pages, one with the div hidden, the other with it shown, and link each page to the other one.
Last edited by MidiMagic : Oct 8th, 2007 at 7:41 pm.
Daylight-saving time uses more gasoline
Reply With Quote  
Join Date: Oct 2007
Posts: 6
Reputation: buggsword is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
buggsword buggsword is offline Offline
Newbie Poster

Re: Toggle div visibility

  #3  
Oct 11th, 2007
I got it working using the following:

function showHide() {
for (var i=0; i<expandCollapse.arguments.length; i++) {
var element = document.getElementById(expandCollapse.arguments[i]);
element.style.display = (element.style.display == "none") ? "block" : "none";
}
}


<a href="javascript: showHide('flashOverlay')">Search site</a>
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 4:09 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC