473,583 Members | 2,751 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Java script menu


Can anyone see whats the problem here. Menus wont open..Works fine i
IE, but none else..
I also need the menus to shut automatically when the next opens..
possibly with a java script function?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD DHTML 4.01 Transitional//EN">
<html>
<head>
<title>Meny</title>
<meta http-equiv="Content-Type" content="text/html
charset=iso-8859-1">
<link rel="stylesheet " href="Styleshee t_lankar.css" type="text/css">

<script language="JavaS cript">

function visadolj1(obj) {

if(obj.style.di splay=='none') {
obj.style.displ ay='block'
var x = 1
}
else {obj.style.disp lay='none'
var x = 2
}
}

</script>
</head>

<body>

<TABLE width="149" border=0 align="center" cellPadding=0>
<TBODY>
<TR>
<TD rowspan="Yes">

<div id="huvud" onclick=
"visadolj1(u1)" >
<p class="medium"> TEXT main<br><br>
</div>

<div id="u1" style="display: none">
<a href="Something .htm" target="main" class="link1">T EXT<br>
<br></a>

<a href="Something .htm" target="main" class="link1">T EXT<br><br></a>

<a href="Something .htm" target="main" class="link1">T EXTbr><br>
</a></div>
</TD>
</TR>
</TBODY>
</TABLE>
</body>
</html

--
bergarat
-----------------------------------------------------------------------
bergarath's Profile: http://www.highdots.com/forums/member.php?userid=9
View this thread: http://www.highdots.com/forums/showthread.php?t=133435

Jul 23 '05 #1
1 1483
bergarath wrote:
<snip>
... Works fine in
IE, but none else.. <snip> function visadolj1(obj) {

if(obj.style.di splay=='none') {
obj.style.displ ay='block'
var x = 1
}
else {obj.style.disp lay='none'
var x = 2
}
} <snip> <div id="huvud" onclick=
"visadolj1(u1)" >
<p class="medium"> TEXT main<br><br>
</div>

<div id="u1" style="display: none">

<snip>

IE has a habit of making IDed elements available by reference as global
variables with names that correspond with the element's ID attribute
value. When the onclick handler is executed the Identifier 'u1' is
resolved against the scope chain and IE finds that global reference and
passes a reference to the DOM eleme3nt to the - visadolj1 - function.

Browsers that do not provide such global references cannot resolve the
identifier and so pass the Undefined value to the function call. This is
covered in the FAQ, along with reliable approaches to referring to IDed
DOM elements.

Richard.
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2764
by: Soefara | last post by:
What I'd like to have a request to, say, http://www.mydomain.com/Aaaa/Bbbb/Cccc be handled by http://www.mydomain.com/Aaaa/index.php but with the "Bbbb" and "Cccc" stored in a request variable or attribute. This becomes very very useful when building multi-lingual websites. This can be done in JSP/servlets using 'filters' and it is...
2
6904
by: Eyal | last post by:
Hey, I would appriciate if anyone can help on this one: I have a java object/inteface having a method with a boolean parameter. As I'm trying to call this method from a javascript it fails on a type mismatch. It is positively because of the boolean(java primitive)parameter. It goes fine if I change this parameter to int or String. This...
14
1863
by: Dafydd | last post by:
I have the following Script in my web page reduce to two pages. <script> function details() { document.getElementById('details').style.visibility='visible'; document.getElementById('capabilities').style.visibility='hidden'; } function capabilities() {
3
4126
by: Tony Williams | last post by:
i have a frames based website, my java menu is in frame "contents" but i want it to load the page in to frame "main", here is the code i have so far: function init() { menus = new menu(130, "vertical", 10, 10, -2, -2, "#CACAFF", "#0000A0", "Verdana,Helvetica", 9, "bold", "bold", "black", "white", 1, "gray", 2, "rollover:tri.gif:tri.gif",...
6
2190
by: Ian Davies | last post by:
Hello I have found the following script php/java for dynamic menu lists. Where a selection from the first updates (filters items in) the other. I have modified it for my tables. However I am getting an error Parse error: parse error, unexpected T_VAR in e:\domains\i\iddsoftware.co.uk\user\htdocs\QuestionDB\Questions.php on line 42
8
1513
Stang02GT
by: Stang02GT | last post by:
I posted a question in the HTML/CSS Forum but i have not received an answer. I have a menu that I am using from http://www.javascriptkit.com . The exact url to the menu i am using is : http://www.javascriptkit.com/script/script2/csstopmenu.shtml My problem is that the page i placed the menu on, everything on that page is centered and...
3
1210
by: telekarper | last post by:
i have the following code between <head> and </head> <script language="JavaScript1.2" src="menun_data.js" ></script> as a part of a dropdownmenu. i want to change menun_data.js for menuf_data.js witch is the same file in an other language. I will use 4 languages, therfore i defined the following array, <script type="text/javascript"> menu=...
7
3602
by: imtmub | last post by:
I have a page, Head tag Contains many Scripts and style sheet for Menu and Page. This code working fine and displaying menus and page as i wanted. Check this page for reference. http://www.marco.com.cn/web-content/marco_re10.html -------------------------------------------------------------- <head> <!-- InstanceBeginEditable...
0
8186
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8329
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8197
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6583
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5704
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3821
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2335
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1436
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1160
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.