2014-02-20 7 views
0

test.aspx 페이지가 있습니다.
HTML 코드는태그 .aspx 페이지의 순서는 어떻게되어야합니까?

<script type='text/javascript' language='javascript' src="scripts/test.js"></script> 
<script type="text/javascript" language='javascript' src="scripts/abc.js"></script> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
<title>"test Application"</title> 
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> 
</head> ... 

입니다하지만이 페이지를 실행하고 할 때, 다음과 같은 오류를 던지고있다.

해제 된 스크립트에서 코드를 실행할 수 없습니다.

Google에서 검색 할 때 메타 태그가 스크립트 태그 뒤에 있어야하므로 대답을 얻었습니다.

.aspx 페이지에 메타 태그 뒤에 스크립트 태그를 삽입하는 것이 좋습니다.

답변

0

당신은

스크립트 태그 http://www.w3schools.com/html/<HTML> 요소 안에 할 필요가 기본 HTML 구조에 대한 몇 가지 독서를해야한다. 이상적으로 본체 태그 끝에 ...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
    <head runat="server"> 
     <title>test Application</title> 
     <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> 
    </head> 
    <body> 
     <form id="myForm" runat="server"> 
      <!-- you html elements --> 
     </form> 
     <script type='text/javascript' language='javascript' src="scripts/test.js"></script> 
     <script type="text/javascript" language='javascript' src="scripts/abc.js"></script> 
    </body> 
</html> 

doctype은 페이지를 표준 모드에서 렌더링하는 데 중요합니다. 그러나 (거의) HTML5를 릴리스하면 더 많은 요소를 활용할 수 있으므로 HTML5를 사용해야합니다. 실시 예 이하 ..

<!doctype html> 
<html lang="en"> 
    <head runat="server"> 
     <title>test Application</title> 
     <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"> 
    </head> 
    <body> 
     <form id="myForm" runat="server"> 
      <!-- you html elements --> 
     </form> 
     <script src="scripts/test.js"></script> 
     <script src="scripts/abc.js"></script> 
    </body> 
</html> 
0

meta script titlehead 태그 내에 있어야한다. 페이지로드 성능을 높이려면 body 끝에 스크립트를로드 할 수도 있습니다.

<!doctype html> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
<script type='text/javascript' language='javascript' src="scripts/test.js"></script> 
<script type="text/javascript" language='javascript' src="scripts/abc.js"></script> 
<title>"test Application"</title> 
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> 
</head> 
<body> 
</body> 
</html> 
1

올바른 구문은

<!doctype html> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
    <head runat="server"> 
     <title>"test Application"</title> 
      <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> 
       <script type='text/javascript' language='javascript' src="scripts/test.js"></script> 
        <script type="text/javascript" language='javascript' src="scripts/abc.js"></script> 
    </head> 
    <body> 
    </body> 
    </html> 

또는 당신은 form 태그의 폐쇄 후 신체 내부의 스크립트 태그를 넣을 수 있습니다.