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
Solved

Javascript or HTML error ? due to IIS settings ?

Posted on 2006-11-08
6
246 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
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

837 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