473,396 Members | 1,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Javascript run-time error when using a server certificate

I have recently set up a server certificate on a web site.
Under certain conditions I need to change the color of a html span
element.
I do this using the following javascript function called from the
onreset attribute of the form element.

function removeWarningMsg()
{
if (isIE) {
document.all.Warning.style.color = "<%=BACKGROUND_COLOUR%>";
}
return true;
}
This was working perfectly fine until I applied the server certificate
to the website.
Now when executing this line of code the following error occurs:
Error: 'document.all.warning.style' is null or not an object.
I am fairly new to both Javascript and SSL so if anyone could throw
any light on to what the issue may be it would be greatly appreciated.
regards Simon
Jul 23 '05 #1
2 2077
Simon wrote:
I have recently set up a server certificate on a web site.
Under certain conditions I need to change the color of a html span
element.
I do this using the following javascript function called from the
onreset attribute of the form element.

function removeWarningMsg()
{
if (isIE) {
document.all.Warning.style.color = "<%=BACKGROUND_COLOUR%>";
}
return true;
}
This was working perfectly fine until I applied the server certificate
to the website.
Now when executing this line of code the following error occurs:
Error: 'document.all.warning.style' is null or not an object.
I am fairly new to both Javascript and SSL so if anyone could throw
any light on to what the issue may be it would be greatly appreciated.
regards Simon


View the source, is the page still producing a <span id="Warning">? If so, are
you using document.all.Warning... or document.all.warning... (the error you
pasted seems to imply the latter). HTML element ids are case-sensitive, so
that's the first thing to check.

Lastly, browser detection isn't a very good way to approach this, you're better
off using feature detection, and you can actually support Netscape 4, IE and
Netscape 7 all on a single page by choosing an alternative to changing the color
to the background color:

function removeWarningMsg() {
var div;
if (document.getElementById) { // IE5.5+, Opera 7, Mozilla
div = document.getElementById('Warning').style;
} else if (document.layers) { // NS4
div = document.layers['Warning'];
} else if (document.all) { // IE < 5.5
div = document.all('Warning');
}
if (div) {
div.visibility = 'hidden';
}
return true;
}

<span style="position:relative;" id="Warning">The warning</span>

"position:relative" is needed so the <span> shows up in the document.layers
collection in Netscape 4.

The comments are a comprehensive list of browsers that support each
method/collection, just an idea to show you what you might need to support the
browsers in your environment (for example, if you do not need to support IE <
5.5, I'd strongly recommend you use document.getElementById() over document.all.

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 23 '05 #2
Thanks for your reply Grant.
I can confirm that the span ID Warning is capitalised, so that
unfortunatley doesn't appear to be the problem.
Thanks for the advice on feature detection though, I will be giving that
a try.
Cheers Simon
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3

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

Similar topics

2
by: Tony Gahlinger | last post by:
I'm learning/experimenting with some simple JS/html markup, running an apache daemon and mozilla firefox browser in RH 9. Let's say I run the following markup with one or more of lines 6-10...
1
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net but could work at...
13
by: Alex Molochnikov | last post by:
Is there any way to find out programmatically if Javascript is supported/enabled in a browser? By "programmatically" I mean on the Java servlet side. TIA Alex Molochnikov Gestalt Corporation
9
by: Pascal Vyncke | last post by:
Hi, I discovered a NEW security hole / exploit in IE6 with SP2 and all the latest security patches. Overview of the exploit: * Bug for all Microsoft Internet Explorer users * Can be...
2
by: howa | last post by:
e.g. <div id="test"> test </div>
6
by: Melih Onvural | last post by:
I need to execute some javascript and then read the value as part of a program that I am writing. I am currently doing something like this: import htmllib, urllib, formatter class...
11
by: RC | last post by:
I wrote many JavaScripts, they can only run in a browser (Netscape, IE, Firefox, etc.) I am wonder how can I run the JavaScript in the command line (UNIX/LINUX, Windows)? Similar we can run Perl,...
7
by: Rabel | last post by:
I am having trouble getting an image in my design to stretch correctly with the main content. Here is a link http://creativeness.com/temptest/test9.html Now the image on the left below the...
2
by: goscottie | last post by:
I need to find a way to either 1. run and check all Validation controls (in my case one CompareValidator) and run client side javascript function. In this case I'll use <asp:Button>. So if all...
2
by: wannasee | last post by:
Hi Folks, I have two issues: 1- I have written following code a code that works in IE but not in firefox. Please see code below. JavaScript version is 1.3. Both browsers should be able to run...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
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...

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.