??xml version="1.0" encoding="utf-8" standalone="yes"?>
<div style="position:absolute;top:2;left:0;width:256px;height:18px;text-align:center;font-size:13px;background:transparent"> </div>
</div>
<br><br><br><br><br><br>
<input type="button" value="start" onclick="processBar.changeMode();if(processBar.isMoving){this.value='Stop';}else{this.value='Start';}">
<script>
document.execCommand("BackgroundImageCache",false,true);
function ProcessBar(obj){
this.isMoving = false;
this.maxLength = parseInt(obj.parentNode.style.width.replace("px",""));
this.nowLength = parseInt(obj.style.width.replace("px",""));
this.moveInterval = 100;
this.moveRange = 1;
this.timer;
this.obj = obj;
ProcessBar.nowObj = this;
this.changeMode = function(){
this.isMoving = !this.isMoving;
if(this.isMoving){
this.timer = window.setInterval(ProcessBar.nowObj.moving, this.moveInterval);
}else{
window.clearInterval(this.timer);
}
}
this.moving = function(){
ProcessBar.nowObj.nowLength += ProcessBar.nowObj.moveRange;
ProcessBar.nowObj.obj.style.width = ProcessBar.nowObj.nowLength;
ProcessBar.nowObj.obj.parentNode.lastChild.firstChild.data = Math.ceil((ProcessBar.nowObj.nowLength/ProcessBar.nowObj.maxLength)*100) + "%";
if(ProcessBar.nowObj.nowLength >= ProcessBar.nowObj.maxLength){
window.clearInterval(ProcessBar.nowObj.timer);
ProcessBar.nowObj.obj.parentNode.lastChild.firstChild.data = "Complete!";
}
}
}
var processBar = new ProcessBar(proc);
</script>
]]>
function enter()
{
if(window.event.keyCode==13)
{
document.Form1.IbtnLogin.click();
}
}
</script>
(2)
onkeypress="if ((event.keyCode == 13)) event.keyCode=0;"
var num_remaining = testleng - desc_el.value.length;
if (num_remaining >= 0) {
remainingchars_el.innerHTML = num_remaining;
document.getElementById('num').style.display = "";
} else {
document.getElementById('num').style.display = "none";
remainingchars_el.innerHTML = "出的字? " + "<font color=red>"+
(-num_remaining + '') + "</font>";
}
}
function isOver(sText)
{
var intlen=sText.value.length;
if (intlen>testleng)
{
alert("描述特征的内容的字数必修于或者等?"+testleng);
sText.focus();
sText.select();
}
}
//--></SCRIPT>
</head>
<body>
<TEXTAREA id=desc onkeydown=GC_UpdateCharCount() onkeyup=GC_UpdateCharCount() onblur="isOver(this);" name=desc rows=4 cols=40></TEXTAREA>
<BR><table><tr><td id="num">q剩下的字数:</td><td><SPAN id=remainingchars>
<SCRIPT language=javascript1.2><!--
GC_UpdateCharCount();
//--></SCRIPT></SPAN></td></tr></table>
</body>
</html>
this 关键字通常在对象的 构造函C使用Q用来引用对象?/p>
CZ
在下面示例中Qthis 指的是新创徏?Car 对象Qƈl三个属性赋倹{?
function Car(color, make, model){
this.color = color;
this.make = make;
this.model = model;
}
对于 JScript 的客L本,如果在其他所有对象的上下文之外?thisQ则它指的是 window 对象?br />
单点_如果在函数里面,this表示当前函数Q?br />
如果触发了事Ӟ比如onclickQ那么this表示当前触发事g的对?br />
打个比喻?javascript像sql语句,DHTML像数据?
或者再打个通俗的比?DHTML像是肉和菜,javascript像是锅和铲?
DOM分ؓDHTML Object ModeQ微软标准)和Document Object ModeQW3C标准Q?br />
document.all.name.attribute ?DHTML Object Mode 微Y标准
document.getElementById(id).attribute ?Document Object Mode w3c的标?br />
因ؓ开发中实际是用的是微Y标准,当然极端情况下还会考虑一下Firefox标准,但W3C标准只供参?在面?br />
市场的开发中,W3C标准没有什么实际h值的.
<input type=button value="Go Back" onclick="history.back(-1)" >
</form>
其中history.back(-1)代表你要q接到的前面一张网c如果你要往后回退5?你可以用history.back(-5)搞定了?/p>
对象属?br />document.title //讄文档标题{h于HTML?lt;title>标签
document.bgColor //讄面背景?br />document.fgColor //讄前景?文本颜色)
document.linkColor //未点击过的链接颜?br />document.alinkColor //Ȁz链?焦点在此链接?的颜?br />document.vlinkColor //已点击过的链接颜?br />document.URL //讄URL属性从而在同一H口打开另一|页
document.fileCreatedDate //文g建立日期Q只d?br />document.fileModifiedDate //文g修改日期Q只d?br />document.fileSize //文g大小Q只d?br />document.cookie //讄和读出cookie
document.charset //讄字符?体中?gb2312
---------------------------------------------------------------------
对象Ҏ
document.write() //动态向面写入内容
document.createElement(Tag) //创徏一个html标签对象
document.getElementById(ID) //获得指定ID值的对象
document.getElementsByName(Name) //获得指定Name值的对象
---------------------------------------------------------------------
images集合(面中的图象)
a)通过集合引用
document.images //对应面上的<img>标签
document.images.length //对应面?lt;img>标签的个?br />document.images[0] //W??lt;img>标签
document.images[i] //Wi-1?lt;img>标签
b)通过nane属性直接引?br /><img name="oImage">
document.images.oImage //document.images.name属?/p>
c)引用囄的src属?br />document.images.oImage.src //document.images.name属?src
d)创徏一个图?br />var oImage
oImage = new Image()
document.images.oImage.src="/1.jpg"
同时在页面上建立一?lt;img>标签与之对应可以显C?/p>
<html>
<img name=oImage>
<script language="javascript">
var oImage
oImage = new Image()
document.images.oImage.src="/1.jpg"
</script>
</html>
----------------------------------------------------------------------
forms集合(面中的表单)
a)通过集合引用
document.forms //对应面上的<form>标签
document.forms.length //对应面?lt;form>标签的个?br />document.forms[0] //W??lt;form>标签
document.forms[i] //Wi-1?lt;form>标签
document.forms[i].length //Wi-1?lt;form>中的控g?br />document.forms[i].elements[j] //Wi-1?lt;form>中第j-1个控?/p>
b)通过标签name属性直接引?br /><form name="Myform"><input name="myctrl"></form>
document.Myform.myctrl //document.表单?控g?/p>
-----------------------------------------------------------------------
<html>
<!--Text控g相关Script-->
<form name="Myform">
<input type="text" name="oText">
<input type="password" name="oPswd">
<form>
<script language="javascript">
//获取文本密码框的?br />document.write(document.Myform.oText.value)
document.write(document.Myform.oPswd.value)
</script>
</html>
-----------------------------------------------------------------------
<html>
<!--Select控g相关Script-->
<form name="Myform">
<select name="oSelect">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</form>
<script language="javascript">
//遍历select控g的option?br /> var length
length=document.Myform.oSelect.length
for(i=0;i<length;i++)
document.write(document.Myform.oSelect[i].value)
</script>
<script language="javascript">
//遍历optionƈ且判断某个option是否被选中
for(i=0;i<document.Myform.oSelect.length;i++){
if(document.Myform.oSelect[i].selected!=true)
document.write(document.Myform.oSelect[i].value)
else
document.write("<font color=red>"+document.Myform.oSelect[i].value+"</font>")
}
</script>
<script language="javascript">
//ҎSelectedIndex打印出选中的option
//(0到document.Myform.oSelect.length-1)
i=document.Myform.oSelect.selectedIndex
document.write(document.Myform.oSelect[i].value)
</script>
<script language="javascript">
//动态增加select控g的option?br /> var oOption = document.createElement("OPTION");
oOption.text="4";
oOption.value="4";
document.Myform.oSelect.add(oOption);
</script>
<html>
-----------------------------------------------------------------------
<Div id="oDiv">Text</Div>
document.all.oDiv //引用囑ֱoDiv
document.all.oDiv.style
document.all.oDiv.style.display="" //囑ֱ讄为可?br />document.all.oDiv.style.display="none" //囑ֱ讄为隐?br />/*document.all表示document中所有对象的集合
只有ie支持此属性,因此也用来判断浏览器的种c?/
<script>
var table_count = 0;
function doAdd(){
var viewTable = document.getElementById("myTable");
var oneTr = document.createElement("TR");
var oneTd = document.createElement("TD");
oneTd.align="center";
oneTd.innerHTML = "<TABLE id='bt_table_" + table_count + "'><tr><td rowspan='2' align='center'>l营状况</td><td colspan='6' align='center'><strong>2005q?lt;/strong></td></tr><tr><td align='center'>合计</td><td width='78' align='center'>增长%</td><td width='71' align='center'>直营</td><td width='74' align='center'>增长%</td><td width='73' align='center'>加盟</td><td width='72' align='center'>增长%</td></tr><tr><td align='center'>营业?万元)</td><td align='center'><input name='textfield5' type='text' value='' size='5' /></td><td align='center'><input name='textfield8' type='text' value='' size='5' /></td><td align='center'><input name='textfield12' type='text' value='' size='5' /></td><td align='center'><input name='textfield14' type='text' value='' size='5' /></td><td align='center'><input name='textfield17' type='text' value='' size='5' /></td><td align='center'><input name='textfield20' type='text' value='' size='5' /></td></tr><tr><td align='center'>利润?万元)</td><td align='center'><input name='textfield6' type='text' value='' size='5' /></td><td align='center'><input name='textfield9' type='text' value='' size='5' /></td><td align='center'><input name='textfield11' type='text' value='' size='5' /></td><td align='center'><input name='textfield15' type='text' value='' size='5' /></td><td align='center'><input name='textfield18' type='text' value='' size='5' /></td><td align='center'><input name='textfield21' type='text' value='' size='5' /></td></tr><tr><td align='center'>E?amp;nbsp; ?万元)</td><td align='center'><input name='textfield7' type='text' value='' size='5' /></td><td align='center'><input name='textfield10' type='text' value='' size='5' /></td><td align='center'><input name='textfield13' type='text' value='' size='5' /></td><td align='center'><input name='textfield16' type='text' value='' size='5' /></td><td align='center'><input name='textfield19' type='text' value='' size='5' /></td><td align='center'><input name='textfield22' type='text' value='' size='5' /></td></tr></TABLE>";
oneTr.appendChild(oneTd);
viewTable.tBodies[0].appendChild(oneTr);
table_count++;
}
//删除指定的行
function doDelete()
{
var myTable = document.getElementById("myTable");
myTable.deleteRow(table_count-1);
table_count--;
}
</script>
</head>
<body class="main_body" >
<table id="myTable" border="1"></table>
<table width="100%" border="0" cellspacing="1" cellpadding="3" align=center class="tableBorder">
<tr>
<td height=25 align="right" class="Forumrow"> </td>
<td height=25 class="Forumrow" colspan="3" align="right"><input type="button" name="Submit6" value="?? onclick="doAdd()">
<input type="button" name="Submit62" value="?? onclick="doDelete()">
<input type="submit" name="Submit622" value="q??> </td>
</tr>
</table>