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;
相关文档:
一、基本使用方法
prototype属性可算是JavaScript与其他面向对象语言的一大不同之处。
简而言之,prototype就是“一个给类的对象添加方法的方法”,使用prototype属性,可以给类动态地添加方法,以便在JavaScript中实现“继承”的效果。
& ......
(一).确认删除用法:
1. BtnDel.Attributes.Add("onclick","return confirm('"+"确认删除?"+"')");
2. linktempDelete.Attributes["onclick"]="javascript:return confirm('"+"确认删除?"+"');";
3. privat ......
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 ......
添加
<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 ......
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 ......