cshelswell
Joined: 01 Feb 2007 Posts: 1
|
Posted: Thu Feb 01, 2007 8:35 pm Post subject: Really stuck with toggling contents of box |
|
|
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] |
|