PDA

View Full Version : Firefox changing link to '.'



gib65
04-30-2010, 02:45 AM
Hello,

I have a website with a teenee-weenee problem. First, here's the link: http://www.shahspace.com/art2 (the problem occurs only in Firefox).

In the lower right cell, I have three links: 'older', 'home', and 'newer'. The home page, which you would be at first, won't have these links when I'm done programming the website, so to see the problem, click on the last thumb at the bottom of the image gallery on the left (you'll have to hover the mouse over the bottom and scroll it down). If you do it correctly, you should see my drawing "Wall of Flames" and the 'older' link should be replaced by a '.'. This '.' is the problem. If you follow the same proceedure in IE, you should notice not even a '.' is there. That's the way I would like it. I would like the link to be completely blank because (obviously) this is the oldest drawing. But for some reason, Firefox insists of replacing it with a '.'.

Here's my code:

index.html:



...
<script language="javascript" type="text/javascript" src="functions.js"></script>
...
<a id="prevlink" href="#nogo" onclick="prev();return false;"><< OLDER</a>
...


function.js:



function changePic(num) {

mainpic.src="mainpics/"+files[num];
setInnerText(title, titles[num]);
setInnerText(date, dates[num]);
setInnerText(comment_body, comments[num]);

cur_pic=num;

if (cur_pic == last_pic) {
setInnerText(nextlink, "");
}
else {
setInnerText(nextlink, "NEWER >>");
}

if (cur_pic == first_pic) {
setInnerText(prevlink, "");
}
else {
setInnerText(prevlink, "<< OLDER");
}
}

...

function prev() {
if (cur_pic > first_pic) {
cur_pic = cur_pic - 1;
changePic(cur_pic);
}
}

...

function setInnerText(obj,text) {
if (document.all) {
obj.innerText = text;
}
else {
obj.textContent = text;
}
}

I bolded the important parts. I'm essentially telling the browser to replace the text of the link with "" when it's the first drawing (I do something equivalent to the 'newer' link when it's the last drawings). In IE this results in a total disappearance of the link. In Firefox, a mysterious '.' appears. This happens even when I set the text-decoration attribute to none in the hyperlinks. Why?

NOTE: aparently, Firefox doesn't recognize 'innerText' which is why my setInnerText function seems a bit elaborate. It first determines which browser is being used, and if it's Firefox, it uses textContent instead of innerText.