The site is 99% finished but a Javascript function is being gay

Jet

Jet

Soldato
Joined
19 Oct 2004
Posts
2,952
Location
Newcastle
Url: www.mfdl.co.uk

Ok, so i'm nearly finished the whole site but have a problem on the "location" page.

The javascript launch function seems to stretch over the text resulting in bright blue link text. A few hours ago it didn't do this; it only launched when the thumbnail image was clicked. I haven't altered any of the scripts so I assume it's the HTML i've changed but I can't see what.

If I delete the text completely the 'copyright' and 'design by' links take over the baton and turn blue. Have I missed a closing tag?

Any help would be great and thanks for the help so far. I can post the CSS if neccessary.
 
Code:
<div id="map"><a href="images/image-1.jpg" rel="lightbox" title="MFDL is located beneath the green arrow"/><img border="0" src= "images/thumb-1.jpg" width="190" height="130" alt="map" /></div>

(edit) There's your problem. You've made the <a> self-closing but <a> is not a self-closing element - it has to contain the content which will display as the link. You need a closing </a> before the </div>:

Code:
<div id="map"><a href="images/image-1.jpg" rel="lightbox" title="MFDL is located beneath the green arrow"><img border="0" src= "images/thumb-1.jpg" width="190" height="130" alt="map" /></a></div>

Ahh, Augmented got in before the edit :p
 
Last edited:
And you've (self-)closed the tag too early.
Code:
<div id="map">
  <a href="images/image-1.jpg" rel="lightbox" 
  title="MFDL is located beneath the green arrow"[B][COLOR=Yellow]/>[/COLOR][/B]
    <img border="0" src= "images/thumb-1.jpg" width="190" height="130" alt="map" />
</div>
So, you need to remove that self-closing slash from the <a> tag, and then add the closing </a> tag at the end.

The reason why you're seeing the issue, but not seeing any validation error, is related to the fact that it's valid XHTML, but invalid HTML. And since you're sending your page as text/html the browser is actually parsing the page as if it were HTML, not XHTML. Thus it is doing heavyweight error-correction (discarding that erroneous closing slash), and leaving that link to expand all the way until it reaches the next available </a> tag.

If you were sending the page as proper XHTML (application/xhtml+xml), you'd see quite a different behaviour as the page is parsed as XHTML. Namely that the link would not be visible and the map would not be clickable.
 
Awesome. That's done it at my end. Yours?

Cheers mate.

Edit: well it does work but I get loads of validation errors as a result. I've clearly done something wrong.

Edit: saw your edit :p that's great now it's ok.
 
Last edited:
Getting crazy with the edits lol.

Another general problem i've encountered. Say i was linking to an external website through a hyperlink. How do I stop the validator throwing up errors inside the url of the link? I have no control over the url itself and if I edit it it will no longer work.
 
If you're linking to a URL with an ampersand in it, you have to escape it as an html entity (so replace & with &amp;), thats about all I can think of that would cause validation to fail on href attribute anyway.
 
Oh, what exactly is "gay" about a javascript function that won't work?

Why not just state "is not working" - its a hell of a lot less offensive.

C
 
ffallic said:
Oh, what exactly is "gay" about a javascript function that won't work?

Why not just state "is not working" - its a hell of a lot less offensive.

C

Get a grip! If you don't like the thread - stay clear. :rolleyes:
 
aix0 said:
Get a grip! If you don't like the thread - stay clear. :rolleyes:
I have to agree I'm afraid, sorry. It's juvenile, but if this chap wants to use gay as a negative thing I don't see why he shouldn't.

With the links, do what rotation says.
 
ffallic said:
Oh, what exactly is "gay" about a javascript function that won't work?

Why not just state "is not working" - its a hell of a lot less offensive.

C

Gay has many meanings in Newcastle. It wasn't meant to be offensive at all; I was trying to inject some humour into a mundane problem.

If it actually offended you, which I doubt, then I apologise.

heavy-rotation said:
If you're linking to a URL with an ampersand in it, you have to escape it as an html entity (so replace & with &amp;), thats about all I can think of that would cause validation to fail on href attribute anyway.

There was at least 9 errors but I changed url, couldn't be bothered with the hassle and I don't like asking people for help if it's possible.
 
Back
Top Bottom