rotating images with link

this is what i have so far. my images work fine but the link doesn't get change. could you help please.
if i take out document["ChangingLink"].href = Links[PicCurrentNum]; then my images loop through fine. but i also want my image to have link on them. the error i'm getting is document.ChangingLink is null or not an object. thank you
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script type="text/javascript">
	var timeDelay = 5; 
	var Pix = new Array
	("images/1.jpg" 
	,"images/2.jpg" 
	,"images/3.jpg" 
	,"images/4.jpg" 
	);
	var Links = new Array
	("http://www.yahoo.com",
	 "http://www.google.com",
	 "http://www.etrade.com",
	 "http://www.microsoft.com"
	);
	var howMany = Pix.length;
	timeDelay *= 1000;
	var PicCurrentNum = 0;
	var PicCurrent = new Image();
	PicCurrent.src = Pix[PicCurrentNum];
	function startPix() {
	setInterval("slideshow()", timeDelay);
	}
	function slideshow() {
	PicCurrentNum++;
	if (PicCurrentNum == howMany) {
	PicCurrentNum = 0;
	LinkCurrentNum = 0;
	}
	PicCurrent.src = Pix[PicCurrentNum];
	document["ChangingLink"].href = Links[PicCurrentNum];
	document["ChangingPix"].src = PicCurrent.src;
	}
</script>
</head>
 
<body OnLoad="startPix()">
<a name="ChangingLink" id="ChangingLink" href="http://www.yahoo.com"><img name="ChangingPix" src="images/1.jpg" border="0"></a>
 
</body>
</html>

Open in new window

StewSupportAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hieloCommented:
try:
document.images["ChangingLink"].href = Links[PicCurrentNum];
      document.images["ChangingPix"].src = PicCurrent.src;
0
hieloCommented:
try:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script type="text/javascript">
      var timeDelay = 5; 
      var Pix = new Array
      ("images/1.jpg" 
      ,"images/2.jpg" 
      ,"images/3.jpg" 
      ,"images/4.jpg" 
      );
	 
      var Links = new Array
      ("http://www.yahoo.com",
       "http://www.google.com",
       "http://www.etrade.com",
       "http://www.microsoft.com"
      );
	 
      var howMany = Pix.length;
      timeDelay *= 1000;
      var PicCurrentNum = 0;
      var PicCurrent = new Image();
      PicCurrent.src = Pix[PicCurrentNum];
	 
      function startPix() {
      setInterval("slideshow()", timeDelay);
      }
	 
      function slideshow() {
      	PicCurrentNum++;
      	if (PicCurrentNum == howMany) {
      		PicCurrentNum = 0;
      		LinkCurrentNum = 0;
      	}
      	PicCurrent.src = Pix[PicCurrentNum]; 
      	document.getElementById("ChangingLink").href = Links[PicCurrentNum];
      	document.getElementById("ChangingPix").src = PicCurrent.src;
      }
</script>
</head>
 
<body OnLoad="startPix()">
<a name="ChangingLink" id="ChangingLink" href="http://www.yahoo.com"><img name="ChangingPix" id="ChangingPix" src="images/1.jpg" border="0"></a>
 
</body>
</html>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
StewSupportAuthor Commented:
thank you. just do documnet.getElementByID("").href
sob. don't know why it didn't work with just document.
0
hieloCommented:
you are welcome
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.