日期:2014-05-16  浏览次数:20347 次

谁能帮我解释一下下面这段代码
(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( "&", "&" )
}