Prototype实战教程----1.$$

2016-02-19 16:37 8 1 收藏

下面,图老师小编带您去了解一下Prototype实战教程----1.$$,生活就是不断的发现新事物,get新技能~

【 tulaoshi.com - Web开发 】

htmlheadtitleTest $$/titlescript src="prototype.js"/scriptscriptfunction test$$(){  /**//*   in case CSS is not your forte, the expression below says   'find all the INPUT elements that are inside   elements with class=field that are inside a DIV   with id equal to loginForm.'  */  var f = $$('div#loginForm .field input');  var s = '';  for(var i=0; if.length; i++){    s += f[i].value + '/';  }  alert(s); // shows: "joedoe1/secret/"  //now passing more than one expression  f = $$('div#loginForm .field input', 'div#loginForm .fieldName');  s = '';  for(var i=0; if.length; i++){    s += ( f[i].value ? f[i].value : f[i].innerHTML ) + '/';  }  alert(s); //shows: "joedoe1/secret/User name:/Password:/"var  temp=$$('div#loginForm .field');  alert(temp.innerHTML);}function testtoColorPart(){var num=new Number(50);  alert(num.toColorPart());  }

(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/webkaifa/)

  /script

div id='loginForm'  div class='field'    span class='fieldName'User name:/span    input type='text' id='txtName' value='joedoe1'/  /div  div class='field'    span class='fieldName'Password:/span    input type='password' id='txtPass' value='secret' /  /div  input type='submit' value='login' //divinput type=button value='test $$()' onclick='test$$();' /input type=button value='testtoColorPart' onclick='testtoColorPart();' //body/html

(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/webkaifa/)

来源:http://www.tulaoshi.com/n/20160219/1612558.html

延伸阅读
标签: Web开发
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"html head titleAjax/title script type="text/javascript" language="javascript" src="prototype.js" /script script type=&...
标签: Web开发
script src="prototype.js"/scriptinput type="button" id="btn" value="click" /input type="button" id="reg" value="register" /input type="button" id="unreg" value="unregister" /div id="status"/divscriptfunction ...
标签: Web开发
htmlheadtitle顶层元素/titlescript src="prototype.js"/scriptscriptvar Person=Class.create();Person.prototype={ initialize:function(){}, name:'', birthday:'', age:'', Show:function(){alert("This is "+this.name);} }; function TestPerson() { var p...
标签: Web开发
script src="prototype.js"/scriptform id="frm"div id="div1" input type="text" id="txt" name="txt" onchange="return alert('Now')"/ input type="text" id="txt2" name="txt2" / input type="button" ...
  原著: David A Rusling 翻译: Banyan & fifa -------------------------------------------------------------------------------- 本书是为那些想了解Linux内核工作原理的Linux狂热爱好者而写。 它并非一本内部手册。主要描叙了Linux设计的原理与机制;以及Linux内核怎样工作及其原因。 Linux...

经验教程

917

收藏

91
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部