读书人

哪位高手能帮小弟我解释一下以下几个内

发布时间: 2012-03-15 11:50:38 作者: rapoo

谁能帮我解释一下以下几个内容!!!比内急还急..
function SinaSideBarShowFocusImage()
{
if(photoList.length != 0)
{
if(currentPhotoId > = photoList.length)
{
currentPhotoId = 0;
}

for(var i = currentPhotoId ; i < photoList.length ; i ++)
{
if(photoList[i][0] != ' ' && photoList[i][0].match(/^http:\/\//))//(这行里面(/^http:\/\//)这句是什么意思???)
{
currentPhotoId = i;
break;
}
}

if(photoList[currentPhotoId][0] == " ")
{
document.getElementById( "focus_image ").innerHTML = " <img id=\ "focus_image\ " src=\ "images/is_loading.png\ " alt=\ "\ " /> ";
}
else
{
var temp = photoList[currentPhotoId][0];

if(isDocked == 1)
{
if(!temp.match(/_100x100/))
{
temp = temp.replace(/\./, "_100x100. ");//(这句又是什么意思??)
}
}
else
{
if(temp.match(/_100x100/))
{
temp = temp.replace(/_100x100\./, ". ");(这句又是什么意思??)
}

}


document.getElementById( "focus_image ").innerHTML = " <a href= " + photoList[currentPhotoId][1] + "> <img id=\ "focus_image\ " onLoading=\ "javascript:this.src= 'images/is_loading.png ';\ " onError=\ "javascript:this.src= 'images/no_internet.png ';\ " src=\ " " + temp + "\ " border=\ "0\ " alt=\ " " + photoList[currentPhotoId][2] + "\ " /> </a> ";
}

currentPhotoId ++ ;
}
else
{
document.getElementById( "focus_image ").innerHTML = " <img id=\ "focus_image\ " src=\ "images/is_loading.png\ " alt=\ "\ " /> ";
}

//document.getElementById( "focus_image ").innerHTML = photoList[currentPhotoId][0];
}


[解决办法]
/^http:\/\//是 正则表达式,表示http://开头的字符
temp = temp.replace(/\./, "_100x100. "); 把.替换为_100X100
temp = temp.replace(/_100x100\./, ". ") 把_100X100替换为点.

读书人网 >JavaScript

热点推荐