首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

哪位高手能帮小弟我解释一下下面这段代码

2012-04-11 
谁能帮我解释一下下面这段代码(editor.options.relativePath ? img.getAttribute( src, 2 ).replace( &

谁能帮我解释一下下面这段代码
(editor.options.relativePath ? img.getAttribute( "src", 2 ).replace( "&", "&" ) : img.src.replace( "&", "&" ))

[解决办法]
是editor.options.relativePath就得到src属性并用&替换&(img.getAttribute( "src", 2 ).replace( "&", "&" )) 不是就直接用替换&(
[解决办法]

等价于 
if (editor.options.relativePath ){
img.getAttribute( "src", 2 ).replace( "&", "&" ) :
}else{
img.src.replace( "&", "&" )
}
[解决办法]

探讨
等价于
if (editor.options.relativePath ){
img.getAttribute( "src", 2 ).replace( "&", "&" ) :
}else{
img.src.replace( "&", "&" )
}

热点排行