javascriptʵÏÖ×Ô¶¯ÇóºÍ
function total(){
var i=0;
for(j=1;j<=20;j++)
{
var step="step"+j;
if(document.getElementById(step)){
if(document.getElementById(step).checked==true)
{
i=i+parseInt(document.getElementById(step).value);
}
}
}
document.getElementById("total").innerHTML = i;
}
function Resetvalue(){
for(j=1;j<=20;j++)
{
if(document.getElementById("step"+j)!=null){
document.getElementById("step"+j)&0;}
document.getElementById("total").innerHTML = "0";}
}
function allselect()
{
for(j=1;j<=20;j++)
{
if(document.getElementById("step"+j)!=null){
document.getElementById("step"+j).checked=true;}
}
var ischecked=0;
var obj=document.getElementById("thisform");
for(k=0;k<obj.vom.length;k++)
{
if(obj.vom[k].checked)
ischecked=1;
}
if(ischecked==0)
{
obj.vom[1].checked=true;
}
total();
}
html²¿·Ö
<form name="thisform">
<input name="step1" type="checkbox" value="1" onClick="total()"/>1<br/>
<input name="step2" type="checkbox" value="2" onClick="total()"/>2<br/>
<input name="step3" type="checkbox" value="3" onClick="total()"/>3<br/>
<input name="step4" type="checkbox" value="4" onClick="total()"/>4<br/>
<input name="step5" type="checkbox" value="5" onClick="total()"/>5<br/>
<input name="step6" type="checkbox" value="6" onClick="total()"/>6<br/>
<div id="total" >0</div>
<input type="button" name="Submit2" value="È«Ñ¡" onclick="allselect()" >
<input type="reset" name="Submit2" value="ÖØÖÃ" onclick="Resetvalue()" >
</form>
---------------------------------HTML²¿·Ö2£¬ÕâÊÇÎÒ¼ÓÉÏÈ¥µÄ£¬Ö»×ö²Î¿¼¡£
<SCRIPTLANGUAGE=javascript> function sumNum() {var number1= isNaN(parseInt(num1.value,10))?0:parseInt(num1.value,10);var number2= isNaN(parseInt(num2.value,10))?0:parseInt(num2.value,10);var number3= isNaN(pars
Ïà¹ØÎĵµ£º
Dynamic Scopes ¶¯Ì¬×÷ÓÃÓò
Both the with statement and the catch clause of a try-catch statement, as well as a function containing eval_r(), are all considered to be dynamic scopes. A dynamic scope is one that exists only through execution of code and therefore cannot be det ......
µÚÈýÕ DOM Scripting DOM±à³Ì
DOM scripting is expensive, and it's a common performance bottleneck in rich web applications. This chapter discusses the areas of DOM scripting that can have a negative effect on an application's responsiveness and gives recommendations o ......
[ת×Ô]http://article.yeeyan.org/view/mouse4x/16540
JSON±»¹«ÈÏΪä¯ÀÀÆ÷ÖÐXMLµÄºó¼ÌÕߣ¬ËüµÄÄ¿±ê½ö½öÊdzÉΪһÖÖ¼òµ¥¡¢ÓÅÑŵÄÊý¾Ý¸ñʽ£¬ÒÔ·½±ãä¯ÀÀÆ÷ºÍ·þÎñÆ÷Ö®¼äµÄÊý¾Ý½»»»¡£ÔÚÍê³ÉÕâÒ»¼òµ¥ÈÎÎñµÄ¹ý³ÌÖУ¬Ëü½«ÒýÁìÏÂÒ»´úÍòάÍø¡£
¶ÔÏó¼ò½é
¿´,Õâ¾ÍÊÇÒ»¸ö¶ÔÏó:
var myFirstObject ={};
¾¡¹Ü¿´ÆðÀ´Í¦¼òµ¥£¬È»¶øÄÇЩ» ......
Òþ²Ø³ÉÔ±±äÁ¿
ÔÚº¯ÊýÌåÄÚ¶¨ÒåµÄ±äÁ¿Îª¾Ö²¿±äÁ¿£¬À뿪º¯Êý¾Í¹ÒµôÁË
ÔÚº¯ÊýÌåÄÚʹÓÃthis.³ÉÔ±±äÁ¿Ãû£¬ÔòΪwindow¶ÔÏ󼶱äÁ¿£¬¼´È«¾Ö±äÁ¿
¹ÊÐèÒªÕâÑùÒþ²Ø³ÉÔ±±äÁ¿£¬ÏòÍâÖ»±©Â¶get¡¢setº¯Êý
function testClass(name){
var _firstname=name;
return {
getname : function() {
return _fir ......
³£¹æµÄ·½·¨Êǽ«ÄêÔÂÈÕÈ¡³ö£¬È»ºó·Ö±ðÅжϷ¶Î§£¬È»ºó¾ÍÅжÏÈòÄê2ÔµÄÌìÊý
¿ÉÒÔͨ¹ýnew Date(string)µÄ¹¹Ô죬±È½ÏÄêÔÂÈÕ×Ö·ûÊÇ·ñ·¢Éú±ä»¯Åжϡ£
function CheckDate(text) {
if (!text) return false;
text = text.replace(/[\/-]0?/g, "/");
if (!text.match(/^\d{4}\/\d{1,2}\/\d{1,2}$/)) return true;
......