我写了个编辑器,可是这里遇到了问题,怎么设置都不行,很少郁闷先贴出代码
function sleft() {//左对齐
var obj = test.document.selection.createRange();
alert(obj.text);
obj.execCommand('JustifyLeft ', '')
} function scenter() {
var obj = test.document.selection.createRange();
alert(obj.text);
obj.execCommand('JustifyCenter ', '')
}
function sright() {
var obj = test.document.selection.createRange();
alert(obj.text);
obj.execCommand('JustifyRight ', '')
}
test 是一个iframe,我已经设置了test.document.designMode="on",已经可以编辑了,可就是为什么不能居左,居中,居右显示,很是郁闷 此外,我在ifram中敲回车键的时候,为什么会多出一行空白,而不是紧接着上一行开始?
function sleft() {//左对齐
var obj = test.document.selection.createRange();
alert(obj.text);
obj.execCommand('JustifyLeft ', '')
} function scenter() {
var obj = test.document.selection.createRange();
alert(obj.text);
obj.execCommand('JustifyCenter ', '')
}
function sright() {
var obj = test.document.selection.createRange();
alert(obj.text);
obj.execCommand('JustifyRight ', '')
}
test 是一个iframe,我已经设置了test.document.designMode="on",已经可以编辑了,可就是为什么不能居左,居中,居右显示,很是郁闷 此外,我在ifram中敲回车键的时候,为什么会多出一行空白,而不是紧接着上一行开始?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货