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
这是控件是主要是起"占位符的做用"
查看全文
相关阅读:
jquery表格伸展
jquery单选框 复选框表格高亮 选中
jquery表单验证
jquery下拉框实现将左边的选项添加到右边区域
jquery checkbox选中状态
关于.net页面提交后css样式不生效的发现
asp.net页面后退,重复弹出上一页对话框处理办法
这几天做完简易酒店管理系统,对Sql Server执行计划的浅显了解
温故而知新--sql存储过程复习
网站前端性能优化之javascript和css
原文地址:https://www.cnblogs.com/mmmhhhlll/p/72136.html
最新文章
C++如何禁止对象的复制操作
C++拷贝构造函数(深拷贝&浅拷贝)
understand 在windows 以及 unbuntu 下的安装
cartographer 分析
qtcreator 快捷键常用
为什么Eureka Client获取服务实例这么慢
snapshot与release
nginx简介及优点总结
tomcat和apache的区别
SqlMapConfig.xml配置
热门文章
web.xml servlet、servlet-mapping配置
web.xml配置
web.xml context-param配置
spring cloud要点简介及常用组件
微服务功能
jquery与ajax应用
jquery 更换皮肤
jquery选项卡
jquery网页字体变大小
jquery表单内容过滤
Copyright © 2011-2022 走看看