国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > HTML > 正文

里面是對一個body的屬性進行server的一些設定,不過可以衍生到其他的一些htmlcontrol

2024-08-26 00:15:36
字體:
來源:轉載
供稿:網友
the first code snippet below uses the attributes collection of the <body> tag (implemented as an htmlcontrol object) to reference its standard html attributes. this method gives you programmatic access to any of the html attributes that you normally hard-code into your <body> tag.

the second method uses the style object property of the htmlcontrol object. by making calls to the style object property's add method, you can add custom styles to your <body> tag. these are implemented as an inline style tag when it is rendered to the browser.
because of this, you may want to research whether the style you are going to implement is compatible with the browser you are targeting.

the techniques used here can be used to set the properties of any html control that does not have a server control equivalent. an example would be the <p> tag.


sample code 1: use the "attributes" collection of the body tag


<%@ page language="c#" %>

<script language="c#" runat="server">
    protected void page_load(object sender, eventargs e) {
        body.attributes["bgcolor"] = "#cccccc";
    }
</script>

<body id="body" runat="server">
    this is the body text.
</body>



sample code 2: use the "style" collection of the body tag


<%@ page language="c#" %>

<script language="c#" runat="server">
    protected void page_load(object sender, eventargs e) {
        body.style.add("background-color","#cccccc");
    }
</script>

<body id="body" runat="server">
        this is the body text.
</body>



notes:
be sure to add the runat="server" attribute to your body tag and give it an id


  • 本文來源于網頁設計愛好者web開發社區http://www.html.org.cn收集整理,歡迎訪問。
  • 發表評論 共有條評論
    用戶名: 密碼:
    驗證碼: 匿名發表
    主站蜘蛛池模板: 金塔县| 资中县| 剑河县| 昌宁县| 黎城县| 翁源县| 旌德县| 聂拉木县| 留坝县| 红河县| 广东省| 辰溪县| 耒阳市| 新化县| 宜昌市| 阜南县| 托里县| 密云县| 崇阳县| 文水县| 马尔康县| 广平县| 濮阳县| 广东省| 北宁市| 菏泽市| 天全县| 白河县| 井冈山市| 昭觉县| 刚察县| 潜江市| 荥阳市| 乌鲁木齐县| 武乡县| 电白县| 柳江县| 从江县| 乾安县| 二连浩特市| 宁都县|