javascript验证2
// JScript 文件
/********************************************************/
/*判定返回值为true或false*/
/********************************************************/
//打开一个新链接
function openwindow()
{
//var $j = jQuery.noConflict();
var www =$("#lblWww").text();
window.open('http://'+www);
}
//打开电子邮箱
function openemail()
{
//var $j = jQuery.noConflict();
var email = $("#lblEmail").text();
document.location='mailto:'+email;
}
//切换菜单
//name:项名称,cursel:当前第几项,n:总共有几项(setTab('one',3,3))
function setTab(name,cursel,n){
for(i=1;i<=n;i++){
var menu=document.getElementById(name+i);
var con=document.getElementById("con_"+name+"_"+i);
menu.className=i==cursel?"hover":"";
con.style.display=i==cursel?"block":"none";
}
}
//添加收藏
function AddFavorite(sURL, sTitle)
{
try{
window.external.addFavorite(sURL, sTitle);
}
catch (e){
try{
window.sidebar.addPanel(sTitle, sURL, "");
}
catch (e){
alert("加入收藏失败,请使用Ctrl+D进行添加");
}
}
}
//设为首页
function SetHome(obj,vrl){
try{
obj.style.behavior='url(#default#homepage)';obj.setHomePage(vrl);
相关文档:
1. 长度限制
<script>
function test()
{
if(document.a.b.value.length>50)
{
alert("不能超过50个字符!");
document.a.b.focus();
return false;
}
}
</script>
<form name=a onsubmit="return test()">
<textarea name="b" cols="40" wrap="VIRTUAL" rows="6"></textarea& ......
JS Check:
javascriptlint http://www.javascriptlint.com/index.htm
jslint http://www.jslint.com/
JS UT:
http://www.jsunit.net/
JS ST:
http://www.outofhanwell.com/ieleak/index.php?title=Main_Page Drip
http://blogs.msdn.com/gpde/pages/javascript-memory-leak-detector.aspx
http://blogs.msdn. ......
利用Cookie:Cookie是浏览器存储少量命名数据.它与某个特定的网页或网站关联在一起。
Cookie用来给浏览器提供内存,以便脚本和服务器程序可以在一个页面中使用另一个页面的输入数据。
Post.htm
以下是引用片段:
<input type="text" name="txt1">
<input type="button" value="Post">
<s ......
Build your web applications quickly and easily using the industry leading web application IDE -- Aptana Studio.
Introduction:
Aptana Studio is a complete web development environment that combines powerful authoring tools for HTML, CSS, and JavaScript, along with thousands of additional plugins ......
function $id(s) {
return document.getElementById(s);
}
//判断小数
function IsFloat(s) {
if (!/^[+\-]?\d+(.\d+)?$/.test(s))
return false;
else
return ......