Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 14th, 2005, 07:23 AM
Registered User
 
Join Date: Feb 2005
Location: Preston, Lancashire, United Kingdom.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Object doesn't support this action

Hello,
I am getting the above error on http://aconomy.b-shop.co.uk/

This is the code from the page. It works in mozilla but not in ie. Can anyone help.

Cheers

var counter1 = 0;
function anim1(destination,linkto, newimage,maxadds)
{
i = document.getElementById(destination);
i.src = img1[counter1].src;
j = document.getElementById(linkto);
j.href = img1[counter1].href;
counter1++;
if(counter1 == 4)
{
counter1 = 0; //sets the counter value to 0
}
}
var start;
var img1 = new Array(4);
img1[0] = new Image();
img1[0].src = 'http://aconomy.b-shop.co.uk/images/aconomy.b-shop.co.uk/advert1.jpg';
img1[0].href = 'http://www.google.com';
img1[1] = new Image();
img1[1].src = 'http://aconomy.b-shop.co.uk/images/aconomy.b-shop.co.uk/advert2.jpg';
img1[1].href = 'http://www.yahoo.com';
img1[2] = new Image();
img1[2].src = 'http://aconomy.b-shop.co.uk/images/aconomy.b-shop.co.uk/advert3.jpg';
img1[2].href = 'http://www.msn.co.uk';
img1[3] = new Image();
img1[3].src = 'http://aconomy.b-shop.co.uk/images/aconomy.b-shop.co.uk/advert4.jpg';
img1[3].href = 'http://www.excite.com';


then this calls the function

start = setInterval("anim1('group1img','group1link','1','4 ')", 2000);
group1img is the id tag of the image
group1link is the id tag of the link.



Reply With Quote
  #2 (permalink)  
Old February 14th, 2005, 08:44 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

It's failing when you try to add the href attribute. You can normally add your own attributes to an element. Maybe try either adding the href before the source, just in case it's because the image hasn't finished loading. Or try using the extended syntax:
Code:
img1[0].setAttribute("href", "http://www.google.com");
As a side issue it looks like your code would be better if the links weere in an array instead of repeating the code four times.

--

Joe (Microsoft MVP - XML)
Reply With Quote
  #3 (permalink)  
Old February 14th, 2005, 09:17 AM
Registered User
 
Join Date: Feb 2005
Location: Preston, Lancashire, United Kingdom.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Cheers. Its works now. Still didn't let me use the href. so i have it setting the alt attribute.

I will put the links into an array. Thanks for the idea.

Reply With Quote
  #4 (permalink)  
Old February 14th, 2005, 09:59 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Personally I'd use the "title" attribute. I did a little experimenting and you can add other attributes, just not one called "href". So "specialHref" is okay, very odd...

--

Joe (Microsoft MVP - XML)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error-Object does not support doesn't support this bootsy Classic ASP Basics 1 May 25th, 2008 07:14 PM
VB6, COM, Object doesn't support this property... thenoseknows Classic ASP Professional 1 July 12th, 2007 05:54 PM
error - Object doesn't support this property jamara VBScript 1 September 10th, 2006 05:13 AM
Object doesn't support DTSGlobalVariables net4hire SQL Server DTS 6 September 3rd, 2004 05:19 PM



All times are GMT -4. The time now is 01:31 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.