Jump to content

Validation Error


Agustine
 Share

Recommended Posts

Element type "img" must be followed by either attribute specifications, ">" or "/>".
I passed my XHTML validation now it is time to pass my CSS validation. I only have one mistake with my CSS and I don't understand what it is telling me. Here is the code...
<a href="contact.html"><img id="contact2" src="Images/contact.png"onmouseover='document.getElementById("contact2").src="Images/contact2.png"'onmouseout='document.getElementById("contact2").src="Images/contact.png"' border="0" alt="Contact Lenses" />

Thanks :)

Link to comment
Share on other sites

Firstly, I don't see where CSS comes into play here... looks like HTML to me.Secondly, just a tip.... instead of writing the whole document.getElementById thing, you can just refer to the same element as "this".For example,

<a href="contact.html"><img id="contact2" src="Images/contact.png"onmouseover='this.src="Images/contact2.png"'onmouseout='this.src="Images/contact.png"' border="0" alt="Contact Lenses" />

Link to comment
Share on other sites

I passed my XHTML validation now it is time to pass my CSS validation. I only have one mistake with my CSS and I don't understand what it is telling me. Here is the code...
<a href="contact.html"><img id="contact2" src="Images/contact.png"onmouseover='document.getElementById("contact2").src="Images/contact2.png"'onmouseout='document.getElementById("contact2").src="Images/contact.png"' border="0" alt="Contact Lenses" />

ThanksĀ  :)

You are being messed with those small ' and " marks :)Should (must) be as:<xx dosome="doIt('string', 'other string');" dosomeother="kimis.car.color = 'silver';"></xx>I think, here is fixed version:
<img id="contact2" src="images/contact.png" onMouseover="document.getElementById('contact2').src = 'images/contact2.png';" onMouseout="document.getElementById('contact2').src = 'images/contact.png';" border="0" alt="Contact Lenses" />

Link to comment
Share on other sites

I think you need to change the border="0" to style="border:0px" so it would look something like this:

<a href="contact.html"><img id="contact2" src="Images/contact.png"onmouseover='document.getElementById("contact2").src="Images/contact2.png"'onmouseout='document.getElementById("contact2").src="Images/contact.png"' style="border:0px" alt="Contact Lenses" /></a>

:)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...