<IMG src="http://192.168.0.3/jingjib/admin/upfile/20050224093347-0.jpg" id="myimg">
<script language="javascript">
document.all.myimg.align = "left";
</script>
<script language="javascript">
document.all.myimg.align = "left";
</script>
解决方案 »
- 关于输出的问题
- function $(id)是什么意思
- Js 代码求助
- 一个包括框架的网页,上、下结构。上边如何用JS来为下边的一个文本框赋值?
- 谁用过ComponentArt 控件,其中它的Dialog控件onFocus事件怎么用?请教大家了,谢谢!
- 本地上传图片到固定的背景(如杯子)后自动的贴在背景上面(弧形)
- 在ztree中怎么从数据库中获取数据展示出来呢?
- 如何在网页装载的时候就隐藏到工具栏和地址栏目啊
- 做一个透明的层,但层上有一个圆圈部分不透明。谁会?
- JS调用Google地图API
- ★☆★☆巨疑惑的一个难题---怎么在web模式下实现报表多页连续打印功能?
- 利用鼠标点击事件控制表格行的背景问题?
window.opener.frames.message.document.execCommand('InsertImage', false, imagePath);
插入的。这个命令不能进行参数添加!
var obj = null;
for(var i=document.images.length; i>=0; i--)if(document.images[i].src==imagePath)obj=document.images[i];
if(obj)obj.align = "left";
window.opener.frames.message.document.execCommand('justifycenter', , null);
//居左
window.opener.frames.message.document.execCommand('justifyleft', , null);
//居右
window.opener.frames.message.document.execCommand('justifyright', , null);
//两端对齐
window.opener.frames.message.document.execCommand('justifyfull', , null);
楼上的没有看明白我的意思:window.opener.frames.message.document.execCommand('justifyleft', , null);结果是:
<P align=left><IMG src="http://192.168.0.3/jingjib/admin/upfile/20050224093347-0.jpg"></P>GageCSDN(稻草人) sfply(随风飘零叶) 还没有解决我的问题:window.opener.frames.message.document.execCommand('InsertImage', false, imagePath);已经插入到编辑器中了,如果只设定图片的if(obj)obj.align = "left";没有实现功能。
我想在代码中添加:align='left'到现在还没有解决方法.
<html>
<head>
<script>
function insertImage(imagePath){
iEdit.focus();
document.selection.clear;
obj1=iEdit.document.selection.createRange()
obj1.pasteHTML("<img src="+imagePath+" align='left'>");
}
</script>
</head>
<body LANGUAGE=javascript onload="iEdit.document.designMode='on'">
<iframe id=iEdit></iframe>
<input type=button onclick=insertImage("http://community.csdn.net/images/CSDN_logo.GIF")>
</body>
</html>