[Javascript] Problem changing link's href property...

Chris Nafziger CNafziger at sauder.com
Fri Jul 13 10:56:14 CDT 2001


Unless I'm reading this incorrectly (JavaScript Bible - 4th ed., by Danny
Goodman, p.594), it *seems* that you can use document.links.href with IE4+
and NN6.  Also, I understand your recommendation... that would definitely be
compatible with more browsers, but I think I'm going with what I have so far
using the index since it's going on a private, IE5+ Extranet.  If it were
public, I'd change it.  Thanks Peter.

-----Original Message-----
From: Peter Brunone [mailto:peter at brunone.com]
Sent: Friday, July 13, 2001 10:51 AM
To: javascript at LaTech.edu
Subject: Re: [Javascript] Problem changing link's href property...


Chris,
 
    I'm not familiar with the document.links collection -- is it new, or an
IE-only thing? -- but if you can't get this working, I recommend having a
hidden form field that stores the current URL and making the link into a
function call that changes document.location.href .
    Do let us know if you figure it out off-list...
 
Cheers,
 
Peter

----- Original Message ----- 
From: Chris  <mailto:CNafziger at sauder.com> Nafziger 
To: 'javascript at LaTech.edu' <mailto:'javascript at LaTech.edu'>  
Sent: Thursday, July 12, 2001 3:55 PM
Subject: [Javascript] Problem changing link's href property...

I'm having a problem with the function below.  The first two lines do what
they are supposed to do just fine.  The third line does manage to change the
URL of the link, however it only works if I use the ID of zero that you see.
If I replace the the zero with the value assigned to the link's name
property, 'JumpTo', similar to the first two function lines, the error
'document.links.JumpTo' is null or not an object comes up.  Why can't I use
the link's name property value for the reference like I did with the images?


// Function that swaps two images and changes the link URL 
// when one of the swatch image's onMouseover event fires.

function imageOn(i)
    { 
    document.images["Unit"].src = UnitImages[i].src;
    document.images["UnitNumber"].src = UnitNumberImages[i].src;
    document.links[0].href = Page[i] 
    }

<a href="LinkToPage.asp" name="JumpTo" id="JumpTo">Link</a>

_______________________________________________
Javascript mailing list
Javascript at LaTech.edu <mailto:Javascript at LaTech.edu> 
http://www.LaTech.edu/mailman/listinfo/javascript
<http://www.LaTech.edu/mailman/listinfo/javascript> 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20010713/8b3dd5b4/attachment.htm>


More information about the Javascript mailing list