Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Jute Powerful Forum  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 Javascript issues with Mozilla
why

問題兒童

总版主


发贴: 4629
积分: 388
于 2004-10-29 23:00 user profilesend a private message to usersend email to whysearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
"Deprecated method document.getSelection called."
and no text would really be selected, therefore the tags would only be added at the end of the contents.

In short, the Javascript on the edit page doesn't work properly on Mozilla 1.7.3 or FireFox 1.0PR1



作者 Re:Javascript issues with Mozilla [Re:why]
阿熊



发贴: 0
积分: 0
于 2004-11-02 07:59 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
javascript问题
除ie外不兼容



作者 Re:Javascript issues with Mozilla [Re:why]
why

問題兒童

总版主


发贴: 4629
积分: 388
于 2004-11-04 10:13 user profilesend a private message to usersend email to whysearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
A simple minded patch to work with Mozilla:

function getActiveText(selectedtext) {
//text = (document.all) ? document.selection.createRange().text : document.getSelection();
text = "";
if (selectedtext.createTextRange) {
text = document.selection.createRange().text
selectedtext.caretPos = document.selection.createRange().duplicate();
} else if (window.getSelection) {
var input = document.form1.body;
text = input.value.substring(input.selectionStart, input.selectionEnd);
} else {
text = document.getSelection();
}
return true;
}

function AddText(NewCode) {
var input = document.form1.body;
if (input.createTextRange && input.caretPos) {
var caretPos = input.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? NewCode + ' ' : NewCode;
} else if (window.getSelection && input.setSelectionRange) {
var len = NewCode.length;
var posStart = input.selectionStart;
var posEnd = input.selectionEnd;
input.value = input.value.substr(0, posStart) + NewCode + input.value.substr(posEnd);
input.setSelectionRange(posStart+len, posStart+len);
} else {
input.value += NewCode;
}
setfocus();
}



作者 Re:Javascript issues with Mozilla [Re:why]
why

問題兒童

总版主


发贴: 4629
积分: 388
于 2005-04-19 02:26 user profilesend a private message to usersend email to whysearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
zua:

Have you tried the code above?

BTW, is there a way to make the spaces show up to indent the code?



作者 Re:Javascript issues with Mozilla [Re:why]
morchory

Neo

Jute Pro User


发贴: 150
积分: 60
于 2005-05-20 17:02 user profilesend a private message to usersend email to morchorysearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
這個問題我也是很煩惱
每次用 firefox
十分麻煩呀

請問一下 Rainman 和 Zua ... 有好的解決方法嗎 ?
感恩呀 .... Smile




flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2020 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号
客服电话 0592-8750026    客服信箱 714923@qq.com    客服QQ 714923