designMode="on" 的状态下iframe内按一下enter
firefox是内容为<br>
ie 为 <p>问题来了
ie的<P> 实在是太大了
好像按了2次enter一样下面的方法在user贴上一些东西在iframe时ie会出现问题
line-height: 150%!important; /* ie7 firefox */
line-height: 0px /* ie6 */有什么方法可以改善
firefox是内容为<br>
ie 为 <p>问题来了
ie的<P> 实在是太大了
好像按了2次enter一样下面的方法在user贴上一些东西在iframe时ie会出现问题
line-height: 150%!important; /* ie7 firefox */
line-height: 0px /* ie6 */有什么方法可以改善
function fnKeypress()
{
//注意:如果焦点不在编辑器内该函数就不起作用了;
var ev = HtmlEdit.event;
//如果时回车则,单换行
if(ev.keyCode==13){
insertHTML("<br>");
return false;//这样回车就是等于失效了,不会加上讨厌的<p>标签
}
}
//在光标位置插入html
function insertHTML(html)
{
var sel = HtmlEdit.document.selection;
if (sel!=null) {
var rng = sel.createRange();
if (rng!=null)
{
rng.pasteHTML(html);
HtmlEdit.focus();
rng.select();
}
}
}
function fnKeypress(){
var ev = textEdit.event;
if(ev.keyCode==13 && !ev.shiftKey){
var s = textEdit.document.selection;
if (s!=null){
var r = s.createRange();
if (r!=null) {r.pasteHTML("<BR/>\r\n");}
}
return false;
}
}
textEdit.document.onkeypress = fnKeypress;function fnKeypress(){
var ev = textEdit.event;
if(ev.keyCode==13 && !ev.shiftKey){
var s = textEdit.document.selection;
if (s!=null){
var r = s.createRange();
if (r!=null) {r.pasteHTML("<BR/>\r\n");}
}
return false;
}
}