易截截图软件、单文件、免安装、纯绿色、仅160KB

Javascript简易教程 1

关于This
1. 它是一个关键字,并不是变量名或属性名。
2. 它实际指function所关联的对象,如果function没有关联任何对象,则this是Global对象
var msg = 'I am global';
function showMsg(){
alert(this.msg);
};
function nestedShowMsg (){
var nested = function(){
alert(this.msg);
};
nested(); 
};
var owner = {msg:'I am local'};
owner.showMsg = showMsg;
owner.nestedShowMsg = nestedShowMsg;
showMsg();  //should be 'I am global'
owner.showMsg(); //should be 'I am local'
owner.nestedShowMsg();should be 'I am global'


相关文档:

JavaScript 读取 JSON


JSON:
[{"subjecttypeId":"1","subjectName":"67","scope":"1",},{"subjecttypeId":"1","subjectName":"345","scope":"1"}]
JavaScript:
       var result = window.eval('(' + JSON+ ')');

for(var p in result){

result[p].subjectName;

alert(result[p] ......

javascript trim方法

在javascript中的string对象没有trim方法,所以trim功能需要自己实现:
代码如下:
Java代码
﹤scriptlanguage=”javascript”﹥   
/**  
*删除左右两端的空格  
*/  
String.prototype.trim=function(){      
  &nbs ......

JavaScript经典语句及其基本应用

■打开■
<input name=Button onClick=document.all.WebBrowser.ExecWB(1,1) type=button value=打开>
<OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
■另存为■
<input name=Button onClick=document.all.WebBrowser.ExecWB(4,1) typ ......

质数 Javascript 之前的那个有点小毛病

<mce:script type="text/javascript"><!--
document.write("<table border=1px border-color=red>"); //表格开始
for (h = 1; h <= 10; h++) {
document.write("<tr>"); //开始第一行
for (s = 1; s <= 10; s++) {
var num = (h-1)*10+s; ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号