//续上面的
function clearAllProperties()
{
inpImgURL.value="";//always updated
inpImgAlt.value="";//not set, krn tdk harus
inpImgAlign.value="";
inpImgWidth.value="";
inpImgHeight.value="";
inpImgTop.value="";
inpImgBottom.value="";
inpImgLeft.value="";
inpImgRight.value="";
}
function doPreview()
{
idImg.style.width="";
idImg.style.height="";
if(inpImgAlt.value!="")idImg.alt=inpImgAlt.value;
else idImg.removeAttribute("alt",0);
idImg.align=inpImgAlign.value;
if(inpImgTop.value!="")idImg.style.marginTop=inpImgTop.value;
else idImg.style.marginTop="";
if(inpImgBottom.value!="")idImg.style.marginBottom=inpImgBottom.value;
else idImg.style.marginBottom="";
if(inpImgLeft.value!="")idImg.style.marginLeft=inpImgLeft.value;
else idImg.style.marginLeft="";
if(inpImgRight.value!="")idImg.style.marginRight=inpImgRight.value;
else idImg.style.marginRight="";
}function doInsert()
{
if(!dialogArguments.oUtil.obj.checkFocus()){return;}//Focus stuff
var oEditor=dialogArguments.oUtil.oEditor;
var oSel=oEditor.document.selection.createRange(); dialogArguments.oUtil.obj.saveForUndo(); if (oSel.parentElement) oElement=oSel.parentElement();
else oElement=oSel.item(0);
sImgAlt=inpImgAlt.value;
sImgAlign=inpImgAlign.value;
sImgBorderTop=idImg.style.borderTop;
sImgBorderBottom=idImg.style.borderBottom;
sImgBorderLeft=idImg.style.borderLeft;
sImgBorderRight=idImg.style.borderRight; var bNoBorder=false;
if((idImg.style.borderTopStyle=="none"||idImg.style.borderTop=="")&&
(idImg.style.borderBottomStyle=="none"||idImg.style.borderBottom=="")&&
(idImg.style.borderLeftStyle=="none"||idImg.style.borderLeft=="")&&
(idImg.style.borderRightStyle=="none"||idImg.style.borderRight==""))
bNoBorder=true; sImgWidth=inpImgWidth.value;
sImgHeight=inpImgHeight.value;
sImgTop=inpImgTop.value;
sImgBottom=inpImgBottom.value;
sImgLeft=inpImgLeft.value;
sImgRight=inpImgRight.value;
dialogArguments.oUtil.obj.doCmd("InsertImage",inpImgURL.value); var oSel=oEditor.document.selection.createRange();
var sType=oEditor.document.selection.type;
if (oSel.parentElement)oElement=oSel.parentElement();
else oElement=oSel.item(0);
if (oElement.tagName=="IMG")
{
oElement.alt=sImgAlt;
oElement.align=sImgAlign; if(bNoBorder)
oElement.border=0;
else
{
oElement.style.borderTop=sImgBorderTop;
oElement.style.borderBottom=sImgBorderBottom;
oElement.style.borderLeft=sImgBorderLeft;
oElement.style.borderRight=sImgBorderRight;
}
if(sImgWidth!="")oElement.width=sImgWidth;
else oElement.width=oElement.width;
if(sImgHeight!="")oElement.height=sImgHeight;
else oElement.height=oElement.height;
if(sImgTop!="")oElement.style.marginTop=sImgTop;
if(sImgBottom!="")oElement.style.marginBottom=sImgBottom;
if(sImgLeft!="")oElement.style.marginLeft=sImgLeft;
if(sImgRight!="")oElement.style.marginRight=sImgRight;
}
self.close()
}
function clearAllProperties()
{
inpImgURL.value="";//always updated
inpImgAlt.value="";//not set, krn tdk harus
inpImgAlign.value="";
inpImgWidth.value="";
inpImgHeight.value="";
inpImgTop.value="";
inpImgBottom.value="";
inpImgLeft.value="";
inpImgRight.value="";
}
function doPreview()
{
idImg.style.width="";
idImg.style.height="";
if(inpImgAlt.value!="")idImg.alt=inpImgAlt.value;
else idImg.removeAttribute("alt",0);
idImg.align=inpImgAlign.value;
if(inpImgTop.value!="")idImg.style.marginTop=inpImgTop.value;
else idImg.style.marginTop="";
if(inpImgBottom.value!="")idImg.style.marginBottom=inpImgBottom.value;
else idImg.style.marginBottom="";
if(inpImgLeft.value!="")idImg.style.marginLeft=inpImgLeft.value;
else idImg.style.marginLeft="";
if(inpImgRight.value!="")idImg.style.marginRight=inpImgRight.value;
else idImg.style.marginRight="";
}function doInsert()
{
if(!dialogArguments.oUtil.obj.checkFocus()){return;}//Focus stuff
var oEditor=dialogArguments.oUtil.oEditor;
var oSel=oEditor.document.selection.createRange(); dialogArguments.oUtil.obj.saveForUndo(); if (oSel.parentElement) oElement=oSel.parentElement();
else oElement=oSel.item(0);
sImgAlt=inpImgAlt.value;
sImgAlign=inpImgAlign.value;
sImgBorderTop=idImg.style.borderTop;
sImgBorderBottom=idImg.style.borderBottom;
sImgBorderLeft=idImg.style.borderLeft;
sImgBorderRight=idImg.style.borderRight; var bNoBorder=false;
if((idImg.style.borderTopStyle=="none"||idImg.style.borderTop=="")&&
(idImg.style.borderBottomStyle=="none"||idImg.style.borderBottom=="")&&
(idImg.style.borderLeftStyle=="none"||idImg.style.borderLeft=="")&&
(idImg.style.borderRightStyle=="none"||idImg.style.borderRight==""))
bNoBorder=true; sImgWidth=inpImgWidth.value;
sImgHeight=inpImgHeight.value;
sImgTop=inpImgTop.value;
sImgBottom=inpImgBottom.value;
sImgLeft=inpImgLeft.value;
sImgRight=inpImgRight.value;
dialogArguments.oUtil.obj.doCmd("InsertImage",inpImgURL.value); var oSel=oEditor.document.selection.createRange();
var sType=oEditor.document.selection.type;
if (oSel.parentElement)oElement=oSel.parentElement();
else oElement=oSel.item(0);
if (oElement.tagName=="IMG")
{
oElement.alt=sImgAlt;
oElement.align=sImgAlign; if(bNoBorder)
oElement.border=0;
else
{
oElement.style.borderTop=sImgBorderTop;
oElement.style.borderBottom=sImgBorderBottom;
oElement.style.borderLeft=sImgBorderLeft;
oElement.style.borderRight=sImgBorderRight;
}
if(sImgWidth!="")oElement.width=sImgWidth;
else oElement.width=oElement.width;
if(sImgHeight!="")oElement.height=sImgHeight;
else oElement.height=oElement.height;
if(sImgTop!="")oElement.style.marginTop=sImgTop;
if(sImgBottom!="")oElement.style.marginBottom=sImgBottom;
if(sImgLeft!="")oElement.style.marginLeft=sImgLeft;
if(sImgRight!="")oElement.style.marginRight=sImgRight;
}
self.close()
}
解决方案 »
- 好急好急的问题啊~大家速度来看看
- document.getElementById('canvas_main')获取绘图上下文总是失败
- ie 中 input type="file" 如何点击输入框弹出文件选择对话框?
- 还未返回时的问题
- 请教个iframe的问题
- 通过js 的DOM进行解析XML的奇怪问题,请大家帮忙,谢谢
- ExtJS4.0+ 组件构造器参数传递问题
- 有三个下拉列表框:年,月,日,我选了年和月之后日的列表框能否自动识别当前月份有多少天??
- 开一个帖子 探讨下js闭包 进程与线程
- 请问前辈 div 里的字体用text-align:center;控制不了呢?
- 用超链接打开网上邻居
- setAttribute设置属性不正确
{
if(!dialogArguments.oUtil.obj.checkFocus()){return;}//Focus stuff
var oEditor=dialogArguments.oUtil.oEditor;
var oSel=oEditor.document.selection.createRange(); if (oSel.parentElement) oElement=oSel.parentElement();
else oElement=oSel.item(0);
if (oElement.tagName=="IMG")
{
dialogArguments.oUtil.obj.saveForUndo();
oElement.src=inpImgURL.value;
oElement.alt=inpImgAlt.value;
oElement.align=inpImgAlign.value;
oElement.style.borderTop=idImg.style.borderTop;
oElement.style.borderBottom=idImg.style.borderBottom;
oElement.style.borderLeft=idImg.style.borderLeft;
oElement.style.borderRight=idImg.style.borderRight; if(idImg.style.borderTopStyle!="none"||
idImg.style.borderBottomStyle!="none"||
idImg.style.borderLeftStyle!="none"||
idImg.style.borderRightStyle!="none")
oElement.removeAttribute("border",0);
if((idImg.style.borderTopStyle=="none"||idImg.style.borderTop=="")&&
(idImg.style.borderBottomStyle=="none"||idImg.style.borderBottom=="")&&
(idImg.style.borderLeftStyle=="none"||idImg.style.borderLeft=="")&&
(idImg.style.borderRightStyle=="none"||idImg.style.borderRight==""))
oElement.border=0; //clean
if(idImg.style.borderTop=="medium none"||idImg.style.borderTopStyle=="none")
{
oElement.style.cssText=oElement.style.cssText.replace("BORDER-TOP: medium none; ","");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-TOP: medium none","");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-TOP: "+idImg.style.borderTopColor+" "+idImg.style.borderTopWidth+"; ","");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-TOP: "+idImg.style.borderTopColor+" "+idImg.style.borderTopWidth,"");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-TOP: "+idImg.style.borderTopWidth+"; ","");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-TOP: "+idImg.style.borderTopWidth,"");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-TOP: "+idImg.style.borderTopColor+"; ","");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-TOP: "+idImg.style.borderTopColor,"");
}
if(idImg.style.borderBottom=="medium none"||idImg.style.borderBottomStyle=="none")
{
oElement.style.cssText=oElement.style.cssText.replace("BORDER-BOTTOM: medium none; ","");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-BOTTOM: medium none","");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-BOTTOM: "+idImg.style.borderBottomColor+" "+idImg.style.borderBottomWidth+"; ","");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-BOTTOM: "+idImg.style.borderBottomColor+" "+idImg.style.borderBottomWidth,"");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-BOTTOM: "+idImg.style.borderBottomWidth+"; ","");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-BOTTOM: "+idImg.style.borderBottomWidth,"");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-BOTTOM: "+idImg.style.borderBottomColor+"; ","");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-BOTTOM: "+idImg.style.borderBottomColor,"");
}
if(idImg.style.borderLeft=="medium none"||idImg.style.borderLeftStyle=="none")
{
oElement.style.cssText=oElement.style.cssText.replace("BORDER-LEFT: medium none; ","");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-LEFT: medium none","");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-LEFT: "+idImg.style.borderLeftColor+" "+idImg.style.borderLeftWidth+"; ","");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-LEFT: "+idImg.style.borderLeftColor+" "+idImg.style.borderLeftWidth,"");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-LEFT: "+idImg.style.borderLeftWidth+"; ","");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-LEFT: "+idImg.style.borderLeftWidth,"");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-LEFT: "+idImg.style.borderLeftColor+"; ","");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-LEFT: "+idImg.style.borderLeftColor,"");
}
if(idImg.style.borderRight=="medium none"||idImg.style.borderRightStyle=="none")
{
oElement.style.cssText=oElement.style.cssText.replace("BORDER-RIGHT: medium none; ","");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-RIGHT: medium none","");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-RIGHT: "+idImg.style.borderRightColor+" "+idImg.style.borderRightWidth+"; ","");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-RIGHT: "+idImg.style.borderRightColor+" "+idImg.style.borderRightWidth,"");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-RIGHT: "+idImg.style.borderRightWidth+"; ","");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-RIGHT: "+idImg.style.borderRightWidth,"");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-RIGHT: "+idImg.style.borderRightColor+"; ","");
oElement.style.cssText=oElement.style.cssText.replace("BORDER-RIGHT: "+idImg.style.borderRightColor,"");
} oElement.style.width="";
oElement.style.height="";
if(inpImgWidth.value!="")oElement.width=inpImgWidth.value;
else oElement.removeAttribute("width",0);
if(inpImgHeight.value!="")oElement.height=inpImgHeight.value;
else oElement.removeAttribute("height",0);
if(inpImgTop.value!="")oElement.style.marginTop=inpImgTop.value;
else oElement.style.marginTop="";
if(inpImgBottom.value!="")oElement.style.marginBottom=inpImgBottom.value;
else oElement.style.marginBottom="";
if(inpImgLeft.value!="")oElement.style.marginLeft=inpImgLeft.value;
else oElement.style.marginLeft="";
if(inpImgRight.value!="")oElement.style.marginRight=inpImgRight.value;
else oElement.style.marginRight="";
}
}
{
if(!dialogArguments.oUtil.obj.checkFocus()){return;}//Focus stuff
var oEditor=dialogArguments.oUtil.oEditor;
var oSel=oEditor.document.selection.createRange(); if (oSel.parentElement) oElement=oSel.parentElement();
else oElement=oSel.item(0); if (oElement.tagName=="IMG")
{
dialogArguments.oUtil.obj.saveForUndo();
oElement.style.width="";
oElement.style.height="";
oElement.removeAttribute("width",0);
oElement.removeAttribute("height",0);
oElement.width=oElement.width;
oElement.height=oElement.height;
realTime();
}
}
</script>
</head>
<body onLoad="loadText();bodyOnLoad()" style="overflow:hidden;"><table width=100% height=100% align=center cellpadding=0 cellspacing=0>
<tr>
<td valign=top style="padding:5;height:100%"> <table width=100%>
<tr>
<td nowrap>
<span id="txtLang" name="txtLang">Source</span>:
</td>
<td colspan=4 style="width:100%">
<table cellpadding="0" cellspacing="0" style="width:100%">
<tr>
<td style="width:100%"><input type="text" id="inpImgURL" name=inpImgURL style="width:100%" class="inpTxt"></td>
<td><input type="button" value="" onClick="openAsset()" id="btnAsset" name="btnAsset" style="display:none;background:url('openAsset.gif');width:23px;height:18px;border:#a5acb2 1px solid;margin-left:1px;"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td nowrap>
<span id="txtLang" name="txtLang">Title</span>:
</td>
<td width="100%">
<input type="text" id="inpImgAlt" name=inpImgAlt style="width:150px" class="inpTxt" onKeyUp="doPreview()">
</td>
<td rowspan="5" style="padding-top:4;padding-right:7">
<div style="height:112px;border-left:#c7c7c7 1 solid;width:1px"></div>
</td>
<td nowrap>
<span id="txtLang" name="txtLang">Spacing</span>:
</td>
<td> </td>
</tr>
<tr>
<td nowrap>
<span id="txtLang" name="txtLang">Alignment</span>:
</td>
<td nowrap>
<select id="inpImgAlign" name="inpImgAlign" style="width:150px" class="inpSel" onChange="doPreview()">
<option value="" selected></option><!-- <Not Set> -->
<option value="absBottom" id="optLang" name="optLang">absBottom</option>
<option value="absMiddle" id="optLang" name="optLang">absMiddle</option>
<option value="baseline" id="optLang" name="optLang">baseline</option>
<option value="bottom" id="optLang" name="optLang">bottom</option>
<option value="left" id="optLang" name="optLang">left</option>
<option value="middle" id="optLang" name="optLang">middle</option>
<option value="right" id="optLang" name="optLang">right</option>
<option value="textTop" id="optLang" name="optLang">textTop</option>
<option value="top" id="optLang" name="optLang">top</option>
</select>
</td>
<td nowrap>
<span id="txtLang" name="txtLang">Top</span>:
</td>
<td nowrap>
<input type="text" name="inpImgTop" size=2 class="inpTxt" onKeyUp="doPreview()"> pixels
</td>
</tr>
<tr>
<td nowrap>
<span id="txtLang" name="txtLang">Border</span>:
</td>
<td nowrap>
<input type="button" name=btnBorder id=btnBorder value=" Border Style " style="width:150px"
onclick="window.showModelessDialog('border.htm',[dialogArguments,idImg],'dialogWidth:460px;dialogHeight:250px;edge:Raised;center:Yes;help:No;resizable:No;')" class="inpBtn" onMouseOver="this.className='inpBtnOver';" onMouseOut="this.className='inpBtnOut'">
</td>
<td nowrap>
<span id="txtLang" name="txtLang">Bottom</span>:
</td>
<td nowrap>
<input type="text" name="inpImgBottom" size=2 class="inpTxt" onKeyUp="doPreview()"> pixels
</td>
</tr>
<tr>
<td nowrap>
<span id="txtLang" name="txtLang">Width</span>:
</td>
<td nowrap rowspan="2">
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<input type="text" name="inpImgWidth" size=2 class="inpTxt"> pixels
</td>
<td rowspan="2" height="50" style="padding-left:3;padding-top:6">
<img src="img_reset.gif" align=left width="13" height="28">
</td>
<td rowspan="2" height="50" style="padding-top:7">
<input type="button" name="btnReset" id="btnReset" value="reset" onClick="resetImageSize()">
</td>
</tr>
<tr>
<td>
<input type="text" name="inpImgHeight" size=2 class="inpTxt"> pixels
</td>
</tr>
</table>
</td>
<td nowrap>
<span id="txtLang" name="txtLang">Left</span>:
</td>
<td nowrap>
<input type="text" name="inpImgLeft" size=2 class="inpTxt" onKeyUp="doPreview()" id="Text2"> pixels
</td>
</tr>
<tr>
<td nowrap>
<span id="txtLang" name="txtLang">Height</span>:
</td> <td nowrap>
<span id="txtLang" name="txtLang">Right</span>:
</td>
<td nowrap>
<input type="text" name="inpImgRight" size=2 class="inpTxt" onKeyUp="doPreview()" id="Text1"> pixels
</td>
</tr> <tr>
<td colspan="5">
<div style="padding:3;"></div>
<div id="divPreview" style="padding:5;padding-left:5;overflow:auto;border:1 dimgray solid;width:100%;height:85;background:#ffffff">
<img src="img.gif" id="idImg" align=left width="53" height="51">Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et
dolore magna aliquyam erat,
sed diam voluptua. At vero eos et accusam et justo
duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. </div>
</div>
</td>
</tr>
</table></td>
</tr>
<tr>
<td class="dialogFooter" style="padding:6;" align="right">
<table cellpadding=1 cellspacing=0>
<tr>
<td>
<input type="button" name=btnCancel id=btnCancel value="cancel" onClick="self.close()" class="inpBtn" onMouseOver="this.className='inpBtnOver';" onMouseOut="this.className='inpBtnOut'">
</td>
<td>
<input type="button" name=btnInsert id=btnInsert value="insert" onClick="doInsert()" style="display:block" class="inpBtn" onMouseOver="this.className='inpBtnOver';" onMouseOut="this.className='inpBtnOut'">
</td>
<td>
<input type="button" name=btnApply id=btnApply value="apply" onClick="doUpdate()" style="display:none" class="inpBtn" onMouseOver="this.className='inpBtnOver';" onMouseOut="this.className='inpBtnOut'">
</td>
<td>
<input type="button" name=btnOk id=btnOk value=" ok " onClick="doUpdate();self.close()" style="display:none;" class="inpBtn" onMouseOver="this.className='inpBtnOver';" onMouseOut="this.className='inpBtnOut'">
</td>
</tr>
</table>
</td>
</tr>
</table></body>
</html>
function openAsset()
{
inpImgURL.value=eval(dialogArguments.oUtil.obj.cmdAssetManager);//出错行在这里
}
我在列表中标注了的呀!我看到我也头晕呀!改一个超在型的网站后台,贴出来这个文档算是小的了!最长的一个文档有三千多行,全是javascript代码!我晕哟!帮帮我嘛!大哥!