jQuery 学习(1) jQuery 的 HelloWord

本文介绍了一个使用Visual Studio 2005创建的简单网页项目,通过结合jQuery和CSS实现文本样式动态变化的效果。文章展示了如何利用jQuery为特定元素添加样式,并通过CSS进一步定制页面布局。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

使用 VS2005 制作了第一个jQuery。 如下:

 主界面:

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

<!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>Untitled Page</title>
    <script type="text/javascript" src="js/jquery.js">
    </script>
    <script type ="text/javascript" src="js/empty.js">    
        </script>
    <link type="text/css" rel="stylesheet" href="css/css1.css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <p class="MsoNormal" style="margin: 0in 0in 10pt">
           <h1 class = "poem">
                On the Insert tab, the galleries
                include items that are designed to coordinate with the overall look of your document.
                </h1></p>
        <p class="MsoNormal" style="margin: 0in 0in 10pt">
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="font-size: 11pt;
                font-family: Calibri">
                You can use these galleries to insert tables, headers, footers, lists, cover pages,
                and other document building blocks. When you create pictures, charts, or diagrams,
                they also coordinate with your current document look.</span></p>
        <p class="MsoNormal" style="margin: 0in 0in 10pt">
            <span style="font-size: 11pt; font-family: Calibri">You can easily change the formatting
                of selected text in the document text by choosing a look for the selected text from
                the Quick Styles gallery on the Home tab. </span></p>
        <p class="MsoNormal" style="margin: 0in 0in 10pt">
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span
                style="font-size: 11pt; font-family: Calibri">You can also format text directly by using
                the other controls on the Home tab. Most controls offer a choice of using the look
                from the current theme or using a format that you specify directly.</span></p>
        <p class="MsoNormal" style="margin: 0in 0in 10pt">
            <span style="font-size: 11pt; font-family: Calibri">To change the overall look of your
                document, choose new Theme elements on the Page Layout tab. </span></p>
        <p class="MsoNormal" style="margin: 0in 0in 10pt">
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span
                style="font-size: 11pt; font-family: Calibri">To change the looks
                available in the Quick Style gallery, use the Change Current Quick Style Set command.
                Both the Themes gallery and the Quick Styles gallery provide reset commands so that
                you can always restore the look of your document to the original contained in your
                current template.</span></p>
    
    </div>
    </form>
</body>
</html>


empty.js的内容:

// JScript File

$(document).ready(function(){
        $('.poem').addClass('emphasized');
    });

 

CSS的内容:

body
{
    font: 62.5% Arial, Verdana, sans-serif;
}

h1
{    
    font-size : 2.5em;
    margin-bottom : 0;    
}

.poem
{
    margin : 0 2em;
}
    
.emphasized
{
    font-style : italic;
    border: 1px solid #888;
    padding : 0.5 em;
}

 

 

一些体会:

必须完全的输入标点, 如 ; 否则就会出现错误。

 

 

转载于:https://www.cnblogs.com/kedk/archive/2009/12/03/1616370.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值