Solved

Javascript or HTML error ? due to IIS settings ?

Posted on 2006-11-08
6
243 Views
Last Modified: 2008-02-01
Hi,

We work in a multiple environment (Dev servers, test servers, prod servers, etc.)

We are supposed to have the same browsers (Internet explorer)

However I am not getting the same behaviour in the environments

I go to a page in my environment and it loads fine.

when I go to load that same page on another environment I get a javascript error while loading the page

Javascript  error

Error: Object Expected

------------
Javascript Code:

//Refresh display: total of currently selected items
var objElement = document.getElementById("checkbox_count");

------------
HTML Code of element in question (checkbox_count)

<td align="left" class="FieldLabelBlue" id="checkbox_count" name="checkbox_count"><span id="checkbox_count"><%=intCheckboxSelectionCount%> items selected</span></td>


What could be the problem: IIS settings are different, Browser version ?
Can somone help ?
0
Comment
Question by:mADOchist
6 Comments
 
LVL 30

Accepted Solution

by:
callrs earned 250 total points
Comment Utility
id="checkbox_count" refers to td, or to span? Should only be used for one element.

http://www.htmlhelp.com/reference/html40/attrs.html     HTML 4 Common Attributes
"The ID attribute uniquely identifies an element within a document. No two elements can have the same ID value in a single document."
0
 
LVL 54

Expert Comment

by:b0lsc0tt
Comment Utility
mADOchist,

Are the browsers all at least updated version 5 or later?  Do you use getElementById in other parts of the page without a problem?  The block of code you provided looks good but IE didn't support it until version 5 (and that may not have been the initial release).  

Let me know if you have any questions or need more information.

b0lsc0tt
0
 
LVL 54

Expert Comment

by:b0lsc0tt
Comment Utility
@Callrs - Good catch on the id.  I missed that and it is definitely a problem.

bol
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 18

Expert Comment

by:ingwa
Comment Utility
Re the ID, what you could do is id="checkbox_count[]" which then allows you to use multiple ones, and it will create an array.

Just something to think about.
0
 
LVL 54

Expert Comment

by:b0lsc0tt
Comment Utility
You should correct the duplicate ids.  If it is done for styling purposes then use class and assign a common class to the elements.  Class can be duplicated.  Ingwa's suggestion is used with duplicate name attributes, which are allowed.  However it would not be wise to ignore the specs because your code may not work with certain browsers or doctypes.  As browsers get more compliant it will "break" that page.

If there is reason besides style sheets that you used a common id and want some help finding an alternative then let us know.

bol
0
 
LVL 1

Author Comment

by:mADOchist
Comment Utility
Thanks
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now