The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Web Design
> JavaScript Development
|
iframe in firefox issue
Discuss iframe in firefox issue in the JavaScript Development forum on Dev Shed. iframe in firefox issue JavaScript Development forum discussing JavaScript and DHTML, AJAX, and issues such as coding cross-browser JavaScript.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

May 5th, 2005, 11:25 PM
|
|
Registered User
|
|
Join Date: May 2005
Posts: 9
Time spent in forums: 6 h 49 m 50 sec
Reputation Power: 0
|
|
|
iframe in firefox issue
I've made a website that uses mainly iframes. I also use a seperate iframe for links. And within my links.html document, I have a links that display/hide certain links within divs when clicked. And the scripting for that is:
Code:
<script type="text/javascript">
<!--
function drop(a) {
if (a.style.display == 'none') {
a.style.display='block';
}
else {
a.style.display='none';
}
}
//-->
</script>
This works fine in IE, but doesn't work in firefox. I've tried moving the javascript to the main document and linking to there, but I can't seem to target the links within the divs. Any help would be great.
|

May 6th, 2005, 12:35 AM
|
 |
mod_dev_shed
|
|
Join Date: Sep 2002
Location: Atlanta, GA
|
|
|
How are you using the function? Show the code used to call drop().
__________________
# Jeremy
Explain your problem instead of asking how to do what you decided was the solution.
|

May 6th, 2005, 12:40 AM
|
|
Registered User
|
|
Join Date: May 2005
Posts: 9
Time spent in forums: 6 h 49 m 50 sec
Reputation Power: 0
|
|
Code:
<a href="javascript:drop(menu);" target="_self">My Models</a><br>
<div id="menu" style="display: none; margin-left: 15px;">
<a href="gundam.html">Gundams</a><br>
<a href="planes.html">Aircraft</a><br>
<a href="home.html">Other</a>
</div>
|

May 6th, 2005, 12:59 AM
|
 |
mod_dev_shed
|
|
Join Date: Sep 2002
Location: Atlanta, GA
|
|
I think you're getting a side-effect of using "a" as your object in IE.
Code:
<script type="text/javascript">
<!--
function drop(elementId) {
var objElement = document.getElementById(elementId);
if (objElement.style.display == 'none') {
objElement.style.display='block';
}
else {
objElement.style.display='none';
}
}
//-->
</script>
|

May 6th, 2005, 02:21 AM
|
 |
CSS & JS/DOM Adept
|
|
Join Date: Jul 2004
Location: USA
|
|
That would work if menu was a variable, but it's an ID.
Code:
<a href="javascript:drop(document.getElementById('menu'));" target="_self">My Models</a>
or with Jeremy's function
Code:
<a href="javascript:drop('menu');" target="_self">My Models</a>
|

May 6th, 2005, 06:43 PM
|
|
Registered User
|
|
Join Date: May 2005
Posts: 9
Time spent in forums: 6 h 49 m 50 sec
Reputation Power: 0
|
|
|
Yay, it worked! Thanks for the help!
|

May 6th, 2005, 07:02 PM
|
 |
Since 439000000
|
|
Join Date: May 2004
Location: Canada
|
|
|
Sometimes I have a similar problem with syntax. Like
getElementByID() instead of using getElementById()
|

May 6th, 2005, 07:06 PM
|
 |
Cunning Linguist
|
|
Join Date: Jul 2003
Location: I used to live at home, now I stay at the house
|
|
Quote: | Originally Posted by acidfourtyfive Sometimes I have a similar problem with syntax. Like
getElementByID() instead of using getElementById() |
Erm... Ok, but how is that similar? 
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|