JavaScript通用Alert美化类
function sAlert(msg,boxtype,func,msgtitle)
sAlert('信息内容',1,'','信息标题')
@msg:提示信息内容
@boxtype:1为弹出框,2为确认框,3为提示框
@func:点确认时执行的函数
@title:信息框标题文字内容
只有msg是必须的,后面的参数可以省略。如果中间的参数为空则在对应位置上''或者""表示(根据实际情况选择单双引号)
调用此方法须在每个使用的页面的head区域加入下面代码。
<mce:script type="text/javascript" src="alert1/alert.js" mce_src="alert1/alert.js"></mce:script>
<link href="alert1/alert.css" mce_href="alert1/alert.css" rel="stylesheet" type="text/css" />
运行效果如下:
<!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" xml:lang="zh-CN" lang="zh-CN">
<head>
<title>弹出框测试页面</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Language" content="gb2312" />
<mce:style type="text/css"><!--
/*<!--[CDATA[*/
*{
margin:0;padding:0;
}
ul li{list-style-type:none;}
html,body{height:100%;}
#textid{padding:10px}
#bgDiv{position:absolute;top:0;left:0;width:100%;height:100%;background:#000;
filter:alpha(opacity:75);opacity:0.6;}
#msgDiv{text-align:center;position:absolute;left:50%;top:50%;line-height:25px;z-index:101;
padding:1px 0 25px;font-size:12px;height:auto!important;height:142px;min-height:142px;
width:255px;background:url(attachments/month_0904/g200942816344.gif) left top repeat-y;}
#msgTxt{clear:both;padding:10px 10px;text-align:left;}
#msgTxt li{border-bottom:1px dotted #69a;}
#msgTitle{font-size:12px;margin:0;height:21px;width:100%;line-height:20px;text-indent:3em;
background:url(attachments/month_0904/n200942816339.gif) left top no-repeat;text-align:left;
filter:alp
相关文档:
scrollHeight: 获取对象的滚动高度。
scrollLeft:设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离
scrollTop:设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离
scrollWidth:获取对象的滚动宽度
offsetHeight:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度
offsetL ......
在js里用到数组,比如 多个名字相同的input, 若是动态生成的, 提交时就需要判断其是否是数组.
if(document.mylist.length != "undefined" ) {} 这个用法有误.
正确的是 if( typeof(document.mylist.length) != "undefined" ) {}
或 if( !isNaN(document.mylist.length) ) {}
typeof的运算数未定义,返回的就是 "un ......
页面:
<script type="text/javascript" src="js/test.js"></script>
。。。。
<body onload="new myTest();" >
以对象方式调用需要使用 new 操作符,test.js的内容:
{ & ......
在JavaScript中没有专门的机制来实现类的继承,但是可以通过拷贝一个类的prototype到另外一个类来实现继承,一种简单的实现如下:
function class1(){
}
function class2(){
}
class2.prototype=class1.prototype;
class2.prototype.moreProperty="xxx";
class2.prototype.moreMethod1=function(){
}
var obj = ne ......
Ajax框架 jQuery
jQuery是一款免费且开放源代码的JavaScript代码库,由John Resig创建。授权协议为GPL和MIT许可证双协议。示例代码: $("p.neat").addClass("ohmy").show("slow"); 特点轻量级经GZip压缩后传输的代码文件仅14KB,未经压缩传送的代码文件仅26KB。 jQuery 1.26版时: 档案档案行数档案Size 备注 jquery-1.2 ......