Jump to content

HTML/CSS Validator


matfish

Recommended Posts

Not sure if this is the right place to post, so I apologise in advance.

 

Iv been using: http://validator.w3.org to validate my HTML (HTML but im using php...)

 

Its throwing a wobbley because the id="title" of an input box has the same id as another, but this is because its in a php loop. I cant put a numeric variable on the end of it like: id="title1" id="title2" from the loop as Im using AJAX to pick up these values for posting.

 

Any ideas?

 

On another note, I have an <a href tag with onmouseover and onlick - but its saying this is an error too - but dont understand why?

 

Im very sloppycode, so any understanding of this would be appreciated.

Link to comment
Share on other sites

Also: Iv got:

 

<input type="image" src="/images/cancel.jpg" name="cancel" id="cancel" value="Cancel" onClick="Javascript:window.close();" />

 

Line 159 column 132: there is no attribute "onClick".

 

So how would i close the window with a button otherwise?

 

 

Link to comment
Share on other sites

Just use a class .title that can be resused as many times as you want.

 

As far as the anchor, show us the exact code you are using...

 

If you are using xhtml you need to keep it all lower case, change it to onclick

 

as far as putting this in the right place, you would probably be better off using the html and css forums, but I hope this gives you your answer.

Link to comment
Share on other sites

Hey thanks for the replies.

 

lower-casing the mouseovers/onclicks worked thanks.

 

I have a form which is being repeated (using edit in place with Ajax) so when I press submit, it takes the form_name[id] and then gets the id=title and id=body of that form for validation before posting but these are the things that are being repeated.

 

I will re-check my coding as I understand id's have to be unque now - may have a work around.

 

Thanks again.

 

Link to comment
Share on other sites

Hey, this is more of a CSS issue and I will post elsewhere, but just wondering as its along the lines of validation.

 

I have:

 

<style type="text/css">

#comment_error<?=$slap_detail['slapID']?> {float:left; color:#FFFFFF; padding:2px 2px 2px 2px;  margin-top:2px; width:226px; border:1px #000099 solid; }

.comment_error_msg<?=$slap_detail['slapID']?> { width:223px; border:0px #003366 solid; background-color:#458CCC; padding-left:3px; border:1px #FF0000 solid; color:#FFFFFF;}

</style>

 

which is in a loop as depending on where the error is, is dependant on the id. This works, but the html validator says I cant put this outside of the head tag. Is there anyway of looping in a css document or shall i just repeat the query in the head which will output the css first?

Link to comment
Share on other sites

Think I understand where your comming from now..

 

Iv got a form, which is repeated in a loop. If I press submit on the first one, javascript validates it (getelementbyid) which it highlights the box, I would then need id=title1 as this is the first form. Wouldnt both forms light up if I getelementbyid id=title ? withour any ID's after it?

 

Many thanks.

 

ps: I think i know what you mean now, as it will use the form id/name to get id=title ? and wouldnt need the number after it?

 

 

Link to comment
Share on other sites

I'm not sure how you're doing your JS call, but you could easily pass the names of the specific items to the script through an onclick or onsubmit event.  If you're validating all the forms at the same time, you can dynamically grab all the elements on the entire page and just loop through them.  If you need to change the style of any of those items, you can reference the offending item and modify it through JS.

 

Post in the JS board... someone can help you get this sorted.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.