By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,442 Members | 1,357 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,442 IT Pros & Developers. It's quick & easy.

Object doesn't support this property or method (IE 6)

P: 3
Help, I've designed and built a portfolio site for a photographer. Now in the debugging process, I've come across an IE 6 bug (only on IE 6, all other browsers work fine). When I try to click on a thumbnail to change the Main Photo, i get an "Object doesn't support this property or method." I don't know what could be causing this. I tried to troubleshoot, but ended destroying the entire thing, so I reverted back to what i had originally. here's the code:

Code from JSP file:

Expand|Select|Wrap|Line Numbers
  1. function swapImage(id,imgNum) { 
  2.     imageNum = imgNum
  3.     mainPhoto = document.getElementById(id);
  4.     mainPhoto.style.display = 'none';
  5.     newSrc = ('images/img' + imageNum + '.jpg');
  6.     document.getElementById(id).src = newSrc; 
  7.     mainPhoto.style.display = 'block';
  8.     mainPhoto.style.setProperty('margin-left','auto',null);
  9.     mainPhoto.style.setProperty('margin-right','auto',null);
  10. }
Code from HTML page:

Code of main photo:

[HTML]<img src="images/img1.jpg" alt="img1" name="img1" id="mainPhoto" />[/HTML]

Code of Thumbnail that should swap main photo:

[HTML]<a href="#" onmousedown="update('title_Box', 'Wells Fargo: Orange County Asian and Pacific Islander Community Alliance')" onclick="swapImage('mainPhoto','1');" ><img src="thumbnails/thumb1_faded.jpg" alt="thumb1" name="thumb1" width="40" height="40" border="0" class="thumbNavImg" id="thumb1" onmouseover="MM_swapImage('thumb1','','thumbnails/thumb1.jpg',1)" onmouseout="MM_swapImgRestore()" /></a>[/HTML]

Here's the page it's from: http://cristinataccone.com/annualreports/index.html

It doesn't like the line: mainPhoto = document.getElementById(id);

Any help or insight would be great. thanks in advance. It only happens on IE 6. Firefox, the swapping works fine and there's no error msg.
Oct 15 '07 #1
Share this Question
Share on Google+
6 Replies


100+
P: 210
When I try to click on a thumbnail to change the Main Photo, i get an "Object doesn't support this property or method."
.

It only happens on IE 6. Firefox, the swapping works fine and there's no error msg.
The setProperty method isn't supported. Just use direct assignment.

BTW, I hope you're going to optimise those pictures, as their file sizes are oversize for download.
Oct 15 '07 #2

gits
Expert Mod 5K+
P: 5,390
hi ...

logician is right ... use:

Expand|Select|Wrap|Line Numbers
  1. var node = document.getElementById('ele_id');
  2.  
  3. // you have to replace JS_property_reference with the javascript
  4. // reference of a css-property for example: 
  5. // background-color -> backgroundColor or
  6. // border-bottom-color -> borderBottomColor
  7. node.style.JS_property_reference = "new_CSS_property_value";
kind regards
Oct 16 '07 #3

P: 3
Thanks Logician.

Using "var" got the swapping code to work. For the CSS coding, should "new_CSS_property_value" be the name of that style I have in my stylesheet?

hi ...

logician is right ... use:

Expand|Select|Wrap|Line Numbers
  1. var node = document.getElementById('ele_id');
  2.  
  3. // you have to replace JS_property_reference with the javascript
  4. // reference of a css-property for example: 
  5. // background-color -> backgroundColor or
  6. // border-bottom-color -> borderBottomColor
  7. node.style.JS_property_reference = "new_CSS_property_value";
kind regards
Oct 16 '07 #4

acoder
Expert Mod 15k+
P: 16,027
Using "var" got the swapping code to work. For the CSS coding, should "new_CSS_property_value" be the name of that style I have in my stylesheet?
In your code, it would be 'auto', e.g.
Expand|Select|Wrap|Line Numbers
  1. mainPhoto.style.setProperty('margin-left','auto',null);
would become
Expand|Select|Wrap|Line Numbers
  1. mainPhoto.style.marginLeft = 'auto';
Oct 16 '07 #5

P: 3
thx guys, that did the trick.
Oct 17 '07 #6

acoder
Expert Mod 15k+
P: 16,027
Glad to hear you got it working. Post again if you have more questions.
Oct 18 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.