JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 30th, 2009, 02:09 PM
gpdesign gpdesign is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2006
Posts: 99 gpdesign User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 h 50 m 19 sec
Reputation Power: 4
GetElementsByTagName('div')

Hello
I have this javascript that gets id of all divs with in particular element, turns all divs off but the one that onmouseover specified.
This works OK in IE Safari and Chrome, but FF won't work.
It gives me error on line with "var anchorTags ="
Any idea why?

Thanks

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-2">
</head>
<body class="thrColFixHdr">

<script language="javascript" type="text/javascript">
	function swapClass(id){
		var anchorTags = subMenu.getElementsByTagName('div');
		for (var i = 0; i < anchorTags.length ; i++){
			anchorTags[i].style.visibility = 'hidden'; 
		}
		document.getElementById(id).style.visibility = 'visible';
	}
</script>

<div id="menu" class="fltrt"><a href="#">SALESPEOPLE</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#">VENDORS</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#">RESELLERS</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="../aboutUs.html" onmouseover="javascript:swapClass('subMenu4');">ABOUT US</a></div>
    <br class="clearfloat" />
    <div id="subMenu" class="subMenu fltrt">
        <div id="subMenu4"><a href="#">Management Team</a> &nbsp;&nbsp;&nbsp; <a href="#">Contact Us</a></div>
        <div id="subMenu3"><a href="#">111111111111</a> &nbsp;&nbsp;&nbsp; <a href="#">2222222222</a></div>
    </div>
    <br class="clearfloat" />
</body>
</html>

Reply With Quote
  #2  
Old June 30th, 2009, 02:52 PM
Winters Winters is online now
Bad Coder
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jul 2003
Posts: 2,845 Winters User rank is General 9th Grade (Above 100000 Reputation Level)Winters User rank is General 9th Grade (Above 100000 Reputation Level)Winters User rank is General 9th Grade (Above 100000 Reputation Level)Winters User rank is General 9th Grade (Above 100000 Reputation Level)Winters User rank is General 9th Grade (Above 100000 Reputation Level)Winters User rank is General 9th Grade (Above 100000 Reputation Level)Winters User rank is General 9th Grade (Above 100000 Reputation Level)Winters User rank is General 9th Grade (Above 100000 Reputation Level)Winters User rank is General 9th Grade (Above 100000 Reputation Level)Winters User rank is General 9th Grade (Above 100000 Reputation Level)Winters User rank is General 9th Grade (Above 100000 Reputation Level)Winters User rank is General 9th Grade (Above 100000 Reputation Level)Winters User rank is General 9th Grade (Above 100000 Reputation Level)Winters User rank is General 9th Grade (Above 100000 Reputation Level)Winters User rank is General 9th Grade (Above 100000 Reputation Level)Winters User rank is General 9th Grade (Above 100000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 15 h 11 m 3 sec
Reputation Power: 1597
Javascript Code:
Original - Javascript Code
  1. var anchorTags = document.getElementById('subMenu').getElementsByTagName('div');
__________________
[PHP] | [Perl] | [Python] | [Java] | [Javascript] | [XML] | [ANSI C] | [C++] | [MySQL] | [FirebirdSQL] | [PostgreSQL] | [HTML] | [XHTML] | [CSS]

If it wasn't for C, we'd be using BASI, PASAL and OBOL.

Reply With Quote
  #3  
Old June 30th, 2009, 03:20 PM
gpdesign gpdesign is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2006
Posts: 99 gpdesign User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 h 50 m 19 sec
Reputation Power: 4
Thank you, works great.



Quote:
Originally Posted by Winters
Javascript Code:
Original - Javascript Code
  1. var anchorTags = document.getElementById('subMenu').getElementsByTagName('div');

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > GetElementsByTagName('div')


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek