日期:2014-05-17  浏览次数:20418 次

aspx页面引入jquery的问题
HTML code

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
   <script src="Scripts/jquery-1.4.1.js" type="text/javascript" />
    <style type="text/css">
    
    .demo
    {
        color:Red;
        font-size:30px;
        font-weight:bold
        }
    </style>
    
  
    
</head>
<body>
   
    <form id="form1" runat="server">
    <div>
        <p class="demo" id="tst">Css Demo.tttttt</p>   
    </div>
    </form>
</body>
</html>


------解决方案--------------------
JScript code

  <script language="javascript" type="text/javascript">
  $(document).ready(function () {
  alert("Hello Word!");
  $(".demo").click(function () {
  alert("jQuery demo!");
  })
  });
//这样试试
  </script>

------解决方案--------------------
这篇文章说。不管是内嵌的还是引用的</script>,都被需要。
我试了下,下面的情形发生在htm和aspx中:
HTML code

<!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>
    <title></title>
    <script src="JScript1.js" type="text/javascript" />
</head>
<body>

this is test
</body>
</html>

------解决方案--------------------
探讨

JScript code

<script language="javascript" type="text/javascript">
$(document).ready(function () {
alert("Hello Word!");
$(".demo").click(function () {
alert("jQuery demo!");
})
});
/……