ASP.net中同时设置控件的多个属性,以及设置背景透明色。
来源:互联网 发布:三亚南湾猴岛网络购票 编辑:程序博客网 时间:2024/05/16 01:46
设置控件的多个属性的方法一【推荐】:
<form id="form1" runat="server" style=" position:absolute; height:220px; width:400px; top:300px; left:650px; background:#87CEEB">
<div style="position:absolute;height:40px;width:40px;background:yellow;left:80px;top:80px;"></div>
设置style时,输入分号好,再按一下空格键,就可以弹出属性列表供选择;不然的话,则不会出现属性列表,必须手动输入,如果对属性不熟,就比较麻烦,有时候会不知道有哪些属性。
【推荐原因: 方法二的onload="getHeight()"这种方式,如果刷新很快的话,会闪屏,因为页面加载时控件的位置,和通过onload事件改变后控件的位置,不一样,一直点击刷新,会看到两处都与控件。方法一的方式,不会闪屏,即使闪屏,控件也在同一位置闪屏。方法一效果好。】
设置控件的多个属性的方法二:
<script type="text/javascript">
function getHeight() {
var form1 = document.getElementById("form1");
//form1.style.height = screen.height / 4;
//form1.style.width = screen.width / 3;
with (form1.style) {
position = "absolute";
height = 220;
width = 400;
top = 300;
left = 650;
backgroundColor = "#999999";// Transparent
}; }
</script>
或者
<script type="text/javascript">
function getHeight() {
var form1 = document.getElementById("form1");
with (form1) {
style.position = "absolute";
style.height = 220;
style.left = 650;
style.backgroundColor = Transparent";//设为背景透明
};
}
</script>
<body style="background-color:Teal" onload="getHeight()">
WITH的意思是{}里面就可以省略掉with()里()的对象了。
设置背景透明色:
using System.Drawing;//用到Color时
aspx.cs中:
Label1.BackColor = Color.Transparent;
- ASP.net中同时设置控件的多个属性,以及设置背景透明色。
- ASP.net中同时设置控件的多个属性,以及设置背景透明色。
- 设置控件背景透明
- 在 ASP.NET 网页中设置控件的 HTML 属性
- html设置控件的背景样式,透明
- 设置控件透明属性:
- 设置Cstatic控件背景透明
- MFC设置控件背景透明
- 设置透明的背景
- 透明背景的设置
- JPanel设置背景以及Jpanel设置透明的解决办法
- MFC中设置static控件背景透明
- 在flash控件中设置使用透明背景播放影片
- SurfaceView中设置背景透明
- asp.net服务器控件属性设置
- asp.net服务器控件属性设置
- asp.net 的 textbox控件怎么设置readonly属性
- 同时设置多个checkBox属性
- [图论] hdu 3836 Equivalent Sets
- hdu搜索
- png8 png24 gif jpeg图片格式对比
- Linux下查找含有某字符串文件的方法
- VS2010中的自动化测试(3)——数据驱动的单元测试
- ASP.net中同时设置控件的多个属性,以及设置背景透明色。
- DVD Decrypter报错"UDF File System Parsing Failed!"
- Ubuntu12.04 root用户登录设置
- 如何定义返回函数指针的函数
- Ruby on Rails 安装
- Visual C++中用MFC ODBC操作Access数据库(1)
- android 添加语言
- 开篇
- Csharp run sql script create database