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

javascript对象机制

                var currItem = listbox.options[currIndex];
                var prevItem = listbox.options[currIndex - 1];
                //alert(currItem);
                alert(prevItem.text);
                listbox.options[currIndex - 1].text = currItem.text;
                listbox.options[currIndex - 1].value = currItem.value;
                alert(prevItem.text);  //两次alert值是不同的
                listbox.options[currIndex].text = prevItem.text;
                listbox.options[currIndex].value = prevItem.value;


相关文档:

JavaScript:prototype属性使用方法

一、基本使用方法
      prototype属性可算是JavaScript与其他面向对象语言的一大不同之处。
简而言之,prototype就是“一个给类的对象添加方法的方法”,使用prototype属性,可以给类动态地添加方法,以便在JavaScript中实现“继承”的效果。
    & ......

JavaScript使用技巧精萃

(一).确认删除用法:
  1. BtnDel.Attributes.Add("onclick","return confirm('"+"确认删除?"+"')");
  2. linktempDelete.Attributes["onclick"]="javascript:return  confirm('"+"确认删除?"+"');";
  3. privat ......

用JavaScript检查文件是否存在

function checkImgAddr(url){
var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("post",url,false);
xmlhttp.send();
if(xmlhttp.readyState==4){
if(xmlhttp.status==404){
return "File Not Exist.";
}else if(xmlhttp.status == 200){
re ......

javascript动态添加/删除div


添加
<script>
var oDiv = document.createElement("DIV");
oDiv.id = "shop01";
oDiv.style.top = 200;
oDiv.style.left = 200;
oDiv.style.background = '#FFFF00';
oDiv.style.visibility = 'visible';
oDiv.innerHTML="123123"
document.body.appendChild(oDiv ......

Javascript 中对HTML编码和解码的方法

String.prototype.HTMLEncode = function() {
var temp = document.createElement ("div");
(temp.textContent != null) ? (temp.textContent = this) : (temp.innerText = this);
var output = temp.innerHTML;
temp = null;
return output;
}
String.prototype.HTMLDecode = function() {
var temp = doc ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号