Flash Games
 FAQ   Search   Memberlist   Usergroups   Register  Profile   Log in to check your private messages   Log in 


Really stuck with toggling contents of box



 

Post new topic   Reply to topic  
   DEVPPL Forum Index -> JavaScript Forum
View previous topic :: View next topic  
Author Message
cshelswell



Joined: 01 Feb 2007
Posts: 1

PostPosted: Thu Feb 01, 2007 8:35 pm    Post subject: Really stuck with toggling contents of box Reply with quote

Hi i'm really stuck with a problem and if someone could help i'd be so grateful. I've been doing php for a bit but at the moment javascript is a little lost on me.

I'm basically trying to make a toggle box that when a user clicks on one link it brings up a box with an url in it when they click on a different link a new url pops up.

Here's an example www.alternatesource.co.uk if you click Smokescreen "cut1" a box comes up with a hyperlink in it. When you click "cut 2" it should be replaced by a new hyperlink but as you can see the old one remains there.

Here's my code
Code:
function toggleLayer(url)
{        
   var txtBox = document.getElementById('box');
   
   var newLink=document.createElement('a');
      newLink.setAttribute('href', url);
      newLink.className='dl';
         
   var linkText=document.createTextNode('Download');
   newLink.appendChild(linkText);

   
   if (txtBox.style.display != 'none')
   {
       txtBox.style.display = 'block';
       document.getElementById('box').appendChild(newLink);

   }
   else
   {
       txtBox.style.display = 'none';
   }
}


if anyone could help that'd be great

Thanks[/code]
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    DEVPPL Forum Index -> JavaScript Forum All times are GMT + 1 Hour
Page 1 of 1

 
 
Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User: Pass:
Log me on automatically each visit:

 


Powered by phpBB © 2001, 2005 phpBB Group - Modified by DEVPPL

Flash Games - Sitemap