在asp.net中启动jquery的问题 [英] problem to start jquery in asp.net
问题描述
我正在使用Visual Studio 2010,但我想从头开始Jquery,但我没有按预期的正确输出.
我创建了一个新的 asp空网站,并在其中添加了母版页,母版页代码如下:
Hi,
I''m using visual studio 2010 and I want to start Jquery from scratch but I''m not having the proper output as supposed.
I''ve made new asp empty website and added masterpage in it the code for masterpage goes:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<!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>
<asp:ContentPlaceHolder id="head" runat="server">
<link href="StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="True">
<Scripts>
<asp:ScriptReference Path="Scripts/jquery-1.4.1.min.js" />
</Scripts>
<div>
<div class="red">
<p>HELLO WORLD</p>
</div>
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</div>
</form>
</body>
</html>
并添加另一个空的Web表单,选择现有的母版页
emptyweb表单的代码
and added another empty web form selecting the existing masterpage
code of emptyweb form
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="jQ.aspx.cs" Inherits="jQ" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script type="text/javascript">
$(document).ready(function() {
$(''.red'').addClass(''color'');
});
</script>
并添加了css,css的代码是
and added the css,code of css is
.color
{
font-style: italic;
text-decoration: underline;
}
我不知道出什么问题了,我应该将HELLO WORLD用斜体显示并加下划线,但要简单明了.
感谢Gracias:D
I don''t know what is wrong,I''m supposed to be getting HELLO WORLD in italics and underlined but its plain.
Gracias for helping :D
推荐答案
(document).ready(function(){
(document).ready(function() {
(''.red'' ).addClass(''color''); }); </script>
(''.red'').addClass(''color''); }); </script>
并添加了css,css的代码是
and added the css,code of css is
.color
{
font-style: italic;
text-decoration: underline;
}
我不知道出什么问题了,我应该将HELLO WORLD用斜体显示并加下划线,但要简单明了.
感谢Gracias的帮助:D
I don''t know what is wrong,I''m supposed to be getting HELLO WORLD in italics and underlined but its plain.
Gracias for helping :D
您忘记关闭asp:ScriptManger标记
< asp:ScriptManager ID ="ScriptManager1" runat ="server" EnablePageMethods ="True">
<脚本>
< asp:ScriptReference Path ="Scripts/jquery-1.4.1.min.js"/>
</脚本>
</asp:ScriptManager>
you are forgeting to close your asp:ScriptManger tag
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="True">
<Scripts>
<asp:ScriptReference Path="Scripts/jquery-1.4.1.min.js" />
</Scripts>
</asp:ScriptManager>
这篇关于在asp.net中启动jquery的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!