随笔分类 - Javascript
摘要:最近一直在做项目,分享下以前收集的Javascript100例,仅供参考。http://files.cnblogs.com/52net/JavaScript100例.zip
阅读全文
摘要://文本框剩余字数提示(字符大小)function textLimitCheckSj(thisArea, maxLength, SpanId) { var str = thisArea.value; if (getChrLen(str, maxLength) > maxLength * 2) { thisArea.value = str.substring(0, x-1); } else { var varss = '(剩余字数:' + Math.floor((maxLength * 2 - getChrLen(str, maxLength)...
阅读全文
摘要:Javascript整理工具,请将下列代码保存为Html格式即可。<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="Content-Type" con
阅读全文
摘要:提醒功能<div id="header"> <script type="text/javascript"> now = new Date(), hour = now.getHours() if(hour < 6){document.write("尊敬的用户:您来的可真早!")} else if (hour < 8){document.write("尊敬的用户:新的一天开始啦!")} else if (hour < 12){document.write("尊敬的用户
阅读全文
摘要:1.让文字不停地滚动 <MARQUEE>滚动文字</MARQUEE> 2.记录并显示网页的最后修改时间 <script language=Javascript> document.write("最后更新时间: "+ document.lastModified +"") </script> 3.关闭当前窗口 <a href="/"onClick="javascript:window.close();return false;">关闭窗口</a> 4.5秒后关闭当前页 <script language="Ja
阅读全文
摘要:<script language="Javascript"><!-- //屏蔽鼠标右键、Ctrl+N、Shift+F10、F11、F5刷新、退格键function document.oncontextmenu(){event.returnValue=false;}//屏蔽鼠标右键function window.onhelp(){return false} //屏蔽F1帮助function document.onkeydown(){ if ((window.event.altKey)&& ((window.event.keyCode==37)
阅读全文
摘要:用户输入金额,自动实现金额的千分位分割。代码如下:<asp:TextBox ID="txtApp_Pcd_Value" runat="server" Width="85px" onkeyup="this.value=comdify(this)"></asp:TextBox>元<script language="javascript" type="text/javascript"> //金额千分位自动分位 function comdify(t
阅读全文
摘要:按钮式: <input name="pclog" type="button" value="GO" onClick="location.href='http://www.w3school.com.cn/'"> 链接式:<a href="javascript:history.go(-1)">返回上一步</a> 开新窗口: <a href="javascript:" onClick="window.open(&#
阅读全文
摘要:方法一:<input type=button value=刷新 onclick="history.go(0)">方法二:<input type=button value=刷新 onclick="location.reload()">方法三:<input type=button value=刷新 onclick="location=location">方法四:<input type=button value=刷新 onclick="window.navigate(location)&q
阅读全文
摘要:代码如下,请根据情况作适当修改<script language="javascript">function delit(){ result="确认要删除?同时会删除相关的信息!" if (confirm(result)) { window.location.href="Default.aspx" } else { window.location.href="Default2.aspx" }}</script><a href="javascript:delit()"&
阅读全文