我觉得下面两段代码本质上应该是一样的,就是变量的一个赋值有点不一样,但是测试的时候代码段1是出不来的,而代码段2是可以实现我的目标的 这是为什么?
代码段1:
function showPic(whichpic){
var source = whichpic.getAttribute("href");
var placeholder = document.getElementById("placeholder");
placeholder.setAttribute("src",source);
var text = whichpic.getAttribute("title");
var description = document.getElementById("description").firstChild.nodeValue;
description = text;
}
代码段2:
function showPic(whichpic){
var source = whichpic.getAttribute("href");
var placeholder = document.getElementById("placeholder");
placeholder.setAttribute("src",source);
var text = whichpic.getAttribute("title");
var description = document.getElementById("description");
description .firstChild.nodeValue= text;
}
慕的地8582982
橋本奈奈未
橋本奈奈未
相关分类