18个HTML小技巧
1、<script language="javascript">
alert("!");
打开新窗口
window.location.href="<%=data_tableName%>list.asp?TypeID=<%=TypeID%>";
window.close();
</script>
2、无效控件
<input disabled type="button" value="删除" name="btnDelete" class=clsbtn onClick="SetDelete()" >
3、变量在字符串中的取值 audname
sql="select isInuse from "&audname&""
4、变量和字符串组合的表达式
"&data_TableName&"ID
="<%=data_tableName%>list.asp?TypeID=<%=TypeID%>"
<form name="form1" method="post" action="/public/demand.asp?tablenamelen=<%=tablename%>">
sql="select * from tableColumntype where tableColumnTypeName='"&tablename1&"/页面生成'"
pagesql="select * from pageBuild where pageBuildTypeID like '%"&session("a")&"____' and pageBuildName='前台选择列表显示'"
DataListSQL="select * from "&tablename1&" where "&request.form("select")&"='"&request.form("textfield")&"'"
5、读取数组个数
ubound(xxx())
6、条件控件无效
<input <%if session("BackRegUserRole")="itgo5_BackRegUserType_1001" then Response.Write "disabled" %> type="submit" name="btnPub" value="" class=clsbtn >
7、ASP复选框的取值
request.form("checkbox")(i)
request.form("checkbox").Count
8、更新表达式
updataPubSQL="update "&data_TableName&" set isInuse=1 where "&data_TableName&"ID='"&request.form("checkbox")(i)&"'"
9、隐藏控件
<input type=hidden name="text type="text">
10、文件间无form的参数传递
1)javascript中:
传:function radiochange1(){
window.open("sendmail_bottom.asp?sneda=cyykkh®a=select mememail from reguser where reguserTypeID='itgo5_RegUserType_1002'",target="mainFrame");
}
2)ASP中:
response.redirect "mailmodify.asp?sendid="&request.form("checkbox")(1)&""
收:request("sneda") 、request("rega")
11、多行文本框值显示
<textarea name="textfield" cols="60" rows="6" ><%=myrs("contentmail")%></textarea>
12、删除被选中的记录
if request.form("checkbox").count=0 then
response.write"必须在编辑的数据上做标记!"
else
set myrc=server.createobject("adodb.connection")
myrc.open application("conn")
for i=1 to request.form("checkbox").count
delsql="delete sendmail where sendmailid='"&request.form("checkbox")(i)&"'"
myrc.execute(delsql)
next
end if
13、刷新页面
document.reload()
14 屏蔽ctrl+N功能
<body onkeydown='if(event.keyCode==78&&event.ctrlKey)return false;'>
15 最简单的打印按钮
<input type=button onclick=self.print() value=打印>
16 用链接打开系统内容
<STYLE type=text/css>BODY {
FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: Verdana
}
TABLE {
FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: Verdana
}
</STYLE>
<P><A href="file:///::{208D2C60-3AEA-1069-A2D7-08002B30309D}"
target=_blank>网上邻居</A></P>
<P><A href="file:///::{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
target=_blank>我的电脑</A></P>
<P><A href="file:///::{450D8FBA-AD25-11D0-98A8-0800361B1103}"
target=_blank>我的文档</A></P>
<P><A href="file:///::{645FF040-5081-101B-9F08-00AA002F954E}"
target=_blank>回收站</A></P>
<P><A
href="file:///::{20D04FE0-3AEA-1069-A2D8-08002B30309D}/::{21EC2020-3AEA-1069-A2DD-08002B30309D}"
target=_blank>控制面板</A></P>
17 看不出的输入框
<input style="border: #ffffff; border-style: solid; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 1px; border-left-width: 0px; background-color: #ffffff;font-family: 宋体; font-size: 9pt;" type=text value=请输入文字>
18 点击本地打开我的电脑等
<a href="file:///::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" target="_blank">我的电脑</a><br><a href="file:///::{208D2C60-3AEA-1069-A2D7-08002B30309D}" target="_blank">网上邻居</a><br><a href="file:///::{645FF040-5081-101B-9F08-00AA002F954E}" target="_blank">回收站</a><br><a href="file:///::{7007ACC7-3202-11D1-AAD2-00805FC1270E}" target="_blank">网络和拨号连接</a><br><a href="file:///::{D20EA4E1-3957-11d2-A40B-0C5020524153}" target="_blank">管理工具</a><br><a href="file:///::{2227A280-3AEA-1069-A2DE-08002B30309D}" target="_blank">打印机</a><br><a href="file:///::{D6277990-4C6A-11CF-8D87-00AA0060F5BF}" target="_blank">计划任务</a><br><a href="file:///::{D20EA4E1-3957-11d2-A40B-0C5020524152}" target="_blank">字体</a>
19 将某一网址设为主页
〖<a href="#" onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.sohu.com');" >设为主页</a>〗
20 客户端控制图片的大小
<asp:Image id="Image1" ImageUrl="/11111.gif" runat="server"></asp:Image>
<script language="JavaScript">
var imgObj = new Image();
imgObj.src=document.all['Image1'].src;
function checkImg(imgObj,winobj){if (typeof(imgObj) == 'object'){
if ((imgObj.width != 0) && (imgObj.height != 0))
{if(imgObj.height>imgObj.width)
{if(imgObj.height>200){winobj.height=200;}}
else
{if(imgObj.width>150){winobj.width=150;}}}
else{setTimeout("checkImg(imgObj,document.all['Image1'])", 100);}}}
checkImg(imgObj,document.all['Image1']);
</script>