share u-haul
新手上路
- 注册
- 2002-11-26
- 消息
- 3
- 荣誉分数
- 0
- 声望点数
- 0
下列JavaScript 不能给出希望的结果. 请问何故? 谢谢!
******** Language="JavaScript">
function getObjByName(name,doc) {
if(!doc) doc = document;
if(doc[name]) return doc[name];
for(var i=0;i < doc.layers.length;i++){
var lyrdoc = doc.layers.document;
if(lyrdoc[name]) return lyrdoc[name];
if(lyrdoc.layers.length > 0) {
var obj = getObjByName(name, lyrdoc);
if(obj) return obj;
}
}
return 0;
}
function swapImg() {
if(!document.image) return;
var args = swapImg.arguments;
for(var i = 0; i < args.length; i+=2) {
var imgSrc = (args[i + 1].indexOf('[') != -1) ? eval(args[i + 1] + ".src") : args[i + 1];
if(getObjByName(args)) getObjByName(args).src = imgSrc;
}
}
**********>
******** Language="JavaScript">
function getObjByName(name,doc) {
if(!doc) doc = document;
if(doc[name]) return doc[name];
for(var i=0;i < doc.layers.length;i++){
var lyrdoc = doc.layers.document;
if(lyrdoc[name]) return lyrdoc[name];
if(lyrdoc.layers.length > 0) {
var obj = getObjByName(name, lyrdoc);
if(obj) return obj;
}
}
return 0;
}
function swapImg() {
if(!document.image) return;
var args = swapImg.arguments;
for(var i = 0; i < args.length; i+=2) {
var imgSrc = (args[i + 1].indexOf('[') != -1) ? eval(args[i + 1] + ".src") : args[i + 1];
if(getObjByName(args)) getObjByName(args).src = imgSrc;
}
}
**********>