Jump to content
gabrielebr

onClick="window.close()"

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

Share this post


Link to post
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>

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...

×
×
  • Create New...