473,847 Members | 1,732 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Simple Script - No Errors on Moz.(checked log) - IE Object Required Error

2 New Member
Hi can anyone help with this little problem. I have a simple script to
swap between two divs on a page. It works perfectly in Firefox & Safari
& Opera. It fails in IE 6 giving Object Required error on initializing
second variable var layer2. I can't get to the bottom of this. Can
anyone help?

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript"> 
  2. function showhide(element) { 
  3.    var layer1 = document.getElementById('layer1').style; 
  4.    var layer2 = document.getElementById('layer2').style; 
  5.    if (element == "php"){ 
  6.      layer1.visibility= "hidden"; 
  7.      layer2.visibility= "visible"; 
  8.    } 
  9.    else if (element == "java") { 
  10.      layer2.visibility= "hidden"; 
  11.      layer1.visibility= "visible"; 
  12.    } 
  13.  
  14. </script> 
  15.  
[HTML]
<div id="layer1" style="visibili ty:visible">
<a href="javascrip t:showhide('php ');">Click here for some PHP
examples</a>
....</div>
<div id="layer2" style="visibili ty:hidden">
<a href="javascrip t:showhide('jav a');">Click here to see Java
examples</a>
....</div>
[/HTML]

Thanks. Matt
Dec 31 '06 #1
5 1674
ronverdonk
4,258 Recognized Expert Specialist
You must have something else causing this. This code runs perfectly well in IE 6.

Ronald :cool:
Dec 31 '06 #2
johnhjohn
43 New Member
This code also works fine in IE 8.
Jan 1 '07 #3
formatt
2 New Member
Hi, I got to the bottom of the problem. It was IE not recognising my valid XHTML. I used a <applet ..../> tag instead of <applet...> </applet> this fixed the problem. Thanks for your replies. Apparently no version of IE can understand XHTML
Jan 2 '07 #4
b1randon
171 Recognized Expert New Member
Hi, I got to the bottom of the problem. It was IE not recognising my valid XHTML. I used a <applet ..../> tag instead of <applet...> </applet> this fixed the problem. Thanks for your replies. Apparently no version of IE can understand XHTML
Ohhh burn! nice. Thanks for posting your solution, so many ppl forget to if they solve their own problem.
Jan 2 '07 #5
Tuanisviet
37 New Member
Ohhh burn! nice. Thanks for posting your solution, so many ppl forget to if they solve their own problem.

Yeah, I was going to suggest to check the way you close your tags.

I had a professor that made us validate everything before submitting any homework assignment.
Jan 2 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

5
1501
by: genc_ymeri | last post by:
Hi over there, We are a team of 6 developping web applications (ASP.Net/C#/VB.Net/SQLServer). What happens is that randomly, each of us get the below error in (PS). We believe that the "acess is denied" error description is a "dummy message" b/c the file name changes the very next time we compile for no reasons. (we think that it didn't have any reason in the first place b/c no changes of any kind were done to it or to the...
24
6355
by: firstcustomer | last post by:
Hi, Firstly, I know NOTHING about Javascript I'm afraid, so I'm hoping that someone will be able to point me to a ready-made solution to my problem! A friend of mine (honest!) is wanting to have on his site, a Javascript Calculator for working out the cost of what they want, for example: 1 widget and 2 widglets = £5.00
7
443
by: imatts | last post by:
Hi can anyone help with this little problem. I have a simple script to swap between two divs on a page. It works perfectly in Firefox & Safari & Opera. It fails in IE 6 giving Object Required error on initializing second variable var layer2. I can't get to the bottom of this. Can anyone help? <script type="text/javascript"> function showhide(element) { var layer1 = document.getElementById('layer1').style; var layer2 =...
4
2098
by: dbee | last post by:
Right. I've got a really, really annoying/difficult/time consuming problem with my development environment. I'm using django to build a web app with paypal integration. My server is hosted remotely, and it is receiving IPN (payment notifications) POST requests from Paypal. I've checked on google and irc and this is my last shot at solving this before I go mad ... :-( The problem is that I can't debug those POST requests. Browser...
0
9887
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9730
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10983
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10648
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10707
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10341
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7883
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7056
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5911
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.