JavaScript document对象
对象属性:
document.title //设置文档标题等价于HTML的<title>标签
document.bgColor //设置页面背景色
document.fgColor //设置前景色(文本颜色)
document.linkColor //未点击过的链接颜色
document.alinkColor //激活链接(焦点在此链接上)的颜色
document.vlinkColor //已点击过的链接颜色
document.URL //设置URL属性从而在同一窗口打开另一网页
document.fileCreatedDate //文件建立日期,只读属性
document.fileModifiedDate //文件修改日期,只读属性
document.fileSize //文件大小,只读属性
document.cookie //设置和读出cookie
document.charset //设置字符集 简体中文:gb2312
----------------------------
常用对象方法:
document.write() //动态向页面写入内容
document.createElement(Tag) //创建一个html标签对象
document.getElementById(ID) //获得指定ID值的对象
document.getElementsByName(Name) //获得指定Name值的对象
document.body.appendChi
相关文档:
<script>
var i = 0;
function insertTr(obj)
{
var tr1 = tb.insertRow(obj.rowIndex+1);
  ......
<body oncontextmenu="return false" onselectstart="return false" ondragstart="return false" onbeforecopy="return false" onmouseup=document.selection.empty() oncopy=document.selection.empty() onselect=document.selection.empty()></body>
讲上面红色显示的插入到网页中就可以实现鼠标右击无效
......
1. 应用 Array.prototype.join实现字符合并
方法1.
String.prototype.times = function(n) {
return Array.prototype.join.call({length:n+1}, this);
};
"js".times(5) // => "jsjsjsjsjs"
方法2.
var ArrayTest=new Array("HE","LL","O");
var hello = Array.prot ......
在开发一个缴费交易时,先发送查询请求到系统A,系统A返回一个字符串格式的欠费金额,因为是定长的,所以都是前补0,本来需要先做处理的,但是由于查询结果如果是欠费的,客户发起缴费交易时,会送给系统B的格式,与系统A返回的是一样的,因此就原样保存然后上送,可是在系统测试时,却发现了一个奇怪的现象,系统A返回的查 ......
function addLoadEvent(fun) {
var oldonload = window.onload;
if(typeof(window.onload) != 'function') {
window.onload = fun;
} else {
window.onload = function() {
oldonload();
fun();
}
}
}
//function insertAfter(newElement, targentElement)
function insertAfter(insertedNode, ......