Solved

Javascript or HTML error ? due to IIS settings ?

Posted on 2006-11-08
6
244 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
ID: 17899874
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
ID: 17899903
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
ID: 17899911
@Callrs - Good catch on the id.  I missed that and it is definitely a problem.

bol
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 18

Expert Comment

by:ingwa
ID: 17899926
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
ID: 17900015
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
ID: 17900016
Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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.
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
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 is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

867 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

26 Experts available now in Live!

Get 1:1 Help Now