Jump to content

onClick="window.close()"


gabrielebr

Recommended Posts

I have this on a page in order to close it: <div><form> <input type="button" value="Chiudi" onClick="window.close()"> </form></div>It is something suggested in many websites but the W3C validator (<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">)gives 4 errors for it .The first one is "Line 38, Column 45: there is no attribute "onClick"<input type="button" value="Chiudi" onClick="window.close()"> "what is wrong ?How can I amend it ?Thank youGabriele

Link to comment
Share on other sites

Attributes in XHTML follow XML rules: no uppercase letters in attribute names.
apparently it is not solvedError Line 37, Column 6: required attribute "action" not specified<form> the code is <div><form> <input type="button" value="Chiudi" onclick="window.close()" /> </form></div>
Link to comment
Share on other sites

you probably find that you require an action attribute within the form tag, but you can remove the form tags completely and use input on its own, and it should still validate.
Thank you,but i didn't understand the answer. Could you please explain the point in other words ?have a nice day gabriele
Link to comment
Share on other sites

when you use element form tags they usually have the attributes 'action' and 'method'.<form action="whateverpage.php" method="post'></form>OR <form action="whateverpage.php" method="get'> </form>The 'action' attribute is required for this element to pass validation, But! you don't actually need the form tags if you are not going to 'post' or 'get' values to another page, which is what you would normally do, but instead use input on its own, So below.<input type="button" value="Chiudi" onclick="window.close()" /> on its own would pass the W3C validation.

Link to comment
Share on other sites

when you use element form tags they usually have the attributes 'action' and 'method'.<form action="whateverpage.php" method="post'></form>OR <form action="whateverpage.php" method="get'> </form>The 'action' attribute is required for this element to pass validation, But! you don't actually need the form tags if you are not going to 'post' or 'get' values to another page, which is what you would normally do, but instead use input on its own, So below.<input type="button" value="Chiudi" onclick="window.close()" /> on its own would pass the W3C validation.
It is true !!!thank you very much !gabriele
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...