PDA

View Full Version : Mike's scroller - full url links only?



ricksj
12-07-2006, 06:43 AM
1) Script Title:
Mike's scroller

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex2/mikescroll.htm

3) Describe problem:
I'm trying to place relative (to my site) urls in my scroller links, but they don't work. Is there a way to do this?

TIA
Rick

This works,

myScroller1.addItem("<a href='http://www.mywebpage.com/events/index.html' target='_blank'>New events this week...</a>");

But this doesn't

myScroller1.addItem("<a href='events/index.html' target='_blank'>New events this week...</a>");

ddadmin
12-07-2006, 08:15 AM
By not working, do you mean a JS error is produced, or simply that the link goes to a non existent page? If the later, it's normal in the sense that relative links produced by JavaScript are always relative to the page in which the link is produced, not where your .js file is. So basically this means depending on which page the script is on, you'd have to adjust the relative link's path accordingly for it to point to the correct page. Not really a pretty solution, so I'd advise most people just use absolute links if possible at all.

ricksj
12-07-2006, 10:58 PM
I fixed the problem - I was previewing the page and the relative links wheren't working. That is, no behavior change, no JS error (in IE) -- although, in FireFox everything worked well.

However, after uploading the page to the site, everything worked fine (in both browsers).