zoukankan
html css js c++ java
动态加载CSS文件
方法一:
<
HEAD
>
<
title
>
WebForm1
</
title
>
<
LINK
rel
="stylesheet"
type
="text/css"
href
=""
id
="mycss"
>
</
HEAD
>
private
void
Button1_Click(
object
sender, System.EventArgs e)
{Page.RegisterStartupScript(
"
css
"
,
@"
<script>mycss.styleSheet.addImport('stylesheet1.css')</script>
"
);
}
方法二:--- 戏子的方法..嘻..抄来的...
<
HEAD
>
<
title
>
WebForm1
</
title
>
<
asp:placeholder
id
="myplaceholder"
runat
="server"
></
asp:placeholder
>
</
HEAD
>
private
void
Button2_Click(
object
sender, System.EventArgs e)
{
System.Web.UI.Control a
=
Page.FindControl(
"
myplaceholder
"
);
System.Web.UI.HtmlControls.HtmlGenericControl objLink
=
new
HtmlGenericControl(
"
LINK
"
);
objLink.Attributes.Add(
"
rel
"
,
"
stylesheet
"
);
objLink.Attributes.Add(
"
type
"
,
"
text/css
"
);
objLink.Attributes.Add(
"
href
"
,
"
StyleSheet1.css
"
);
objLink
=
objLink;
a.Controls.Add(objLink);
}
[注]
asp:placeholder
这是控件是主要是起"占位符的做用"
查看全文
相关阅读:
LINQ to Entities 查询中的标准查询运算符
LINQ to Entities 基于方法的查询语法
ajax 与 form 提交的区别
i++ & ++i 区别
sizeof 数据类型大小 32位&64位
标准数据类型宏定义
long & int 区别
类函数修饰 const
指针
数组
原文地址:https://www.cnblogs.com/mmmhhhlll/p/72136.html
最新文章
【oracle】oracle数据库建立序列、使用序列实现主键自增
Uncaught ReferenceError:xxx is not defined
【idea】代码提示不区分大小写
0805任务
什么是事件代理(委托)?应用场景?
(节流)js防止重复频繁点击或者点击过快方法
JS中try.. catch..的用法
typeof 与 instanceof之间的区别
Javascript中的继承?如何实现继承?
JavaScript中的事件模型如何理解?
热门文章
js中this对象的理解
ES6中Module以及使用场景
Vue3.0 所采用的 Composition Api 与 Vue2.x 使用的 Options Api 有什么不同?
Vue3.0里为什么要用 Proxy API 替代 defineProperty API
VUE 学习笔记 三 模板语法
VUE 学习笔记 二 生命周期
VUE 学习笔记 一 指令
eayui js动态加载Datagrid,自适应宽度,高度
web api 跨域问题的解决办法
Linq常用List操作总结,ForEach、分页、交并集、去重、SelectMany等
Copyright © 2011-2022 走看看