javascript - Code Does Not Work WIth at the top -


I have & lt ;! DOCTYPE html & gt; What's more at the top of my page is that the user allows to click anywhere on the page, and then redirects to another URL.

This works when I & lt ;! DOCTYPE html , but I keep it in the page

Here is the code:

   & Lt; Title & gt; Untitled document & lt; / Title & gt; & Lt; Style & gt; the body. Center page {cursor: hand; } & Lt; / Style & gt; & Lt; Script & gt; Function goto () {location.href = "http://www.google.com"} & lt; / Script & gt; & Lt; / Head & gt; & Lt; Body class = "enterPage" onclick = "goto ();" & Gt; Your content & lt; / Body & gt; & Lt; / Html & gt;   

Why does this happen?

@Pointy appreciate comments, in addition, make the following changes to your CSS:

  & lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Meta http-equiv = "content-type" content = "text / html; charset = UTF-8" /> & Lt; Title & gt; Untitled document & lt; / Title & gt; & Lt; Style & gt; Body.enterPage {Cursor: Indicator; // no hands! } Html, body {// set document width / height 100% width: 100%; Height: 100%; } & Lt; / Style & gt; & Lt; Script & gt; Function goto () {location.href = "http://www.google.com"} & lt; / Script & gt; & Lt; / Head & gt; & Lt; Body class = "enterPage" onclick = "goto ();" & Gt; Your content & lt; / Body & gt; & Lt; / Html & gt;    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -