Solved

Javascript or HTML error ? due to IIS settings ?

Posted on 2006-11-08
6
250 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 18

Expert Comment

by:Mark Gilbert
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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

617 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