Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Javascript or HTML error ? due to IIS settings ?

Posted on 2006-11-08
6
Medium Priority
?
255 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 1000 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

972 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