Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 14th, 2005, 07:23 AM
Registered User
 
Join Date: Feb 2005
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.



 
Old February 14th, 2005, 08:44 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
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)
 
Old February 14th, 2005, 09:17 AM
Registered User
 
Join Date: Feb 2005
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.

 
Old February 14th, 2005, 09:59 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
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)





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





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