Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 place tags around highlighted text in IE
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

e3stone
Average Member

USA
885 Posts

Posted - 26 June 2002 :  04:11:42  Show Profile  Send e3stone an AOL message
I saw a post about this in the archives and didn't quite understand why things were done the way they were. Here's the archived post:
http://forum.snitz.com/forum/topic.asp?ARCHIVE=true&TOPIC_ID=3868

Instead of checking for what browser the user has, should we just check to see if a feature we need is available in whatever browser they're using? example: Change all "<>" to brackets


if (document.selection) {
strSelection = document.selection.createRange().text
if (!strSelection) {
AddTxt="<b></b>";
AddText(AddTxt);
} else {
document.selection.createRange().text = "<b>" + strSelection + "</b>"
return;
}
} else {
AddTxt="<b></b>";
AddText(AddTxt);
}


This would put <b></b> (in brackets) tags around the highlighted text in IE or whichever browser supported this, and use the old way (add it wherever the cursor is) in Netscape. This way, if Opera decided to start using this feature, it would be automatically detected by the user's browser. The only file that would have to be changed is inc_code.asp, correct?

If this issue has already been addressed, I appologize.

<-- Eric -->

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 26 June 2002 :  04:17:33  Show Profile
Here's what is going to be used in v3.4:

function AddText(NewCode) {
if (document.PostTopic.Message.createTextRange && document.PostTopic.Message.caretPos) {
var caretPos = document.PostTopic.Message.caretPos;
caretPos.text = NewCode;
} else {
document.PostTopic.Message.value+=NewCode;
}
document.PostTopic.Message.focus();
}



function bold() {
var text = getText();
if (helpstat) {
alert("Bold Tag Makes the enclosed text bold.\n\nUSE: [b]This is some bold text[/b]");
} else if (basic) {
AddTxt="[b]" + text + "[/b]";
AddText(AddTxt);
} else {
if (text) {
txt=prompt("Text to be made BOLD.",text);
} else {
txt=prompt("Text to be made BOLD.","Text");
}
if (txt!=null) {
AddTxt="[b]" + txt + "[/b]";
AddText(AddTxt);
}
}
}


function getText() {
if (document.PostTopic.Message.createTextRange && document.PostTopic.Message.caretPos) {
return document.PostTopic.Message.caretPos.text;
} else {
return '';
}
}
Go to Top of Page

Etymon
Advanced Member

United States
2385 Posts

Posted - 05 July 2002 :  15:41:03  Show Profile  Visit Etymon's Homepage

Will this work evenly across Netscape 4.xx and greater as well as IE 4.xx and greater and Opera browsers?

Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 05 July 2002 :  15:57:23  Show Profile
It only works in Internet Explorer. All other browsers just work the same as they do now.
Go to Top of Page

Etymon
Advanced Member

United States
2385 Posts

Posted - 05 July 2002 :  22:59:07  Show Profile  Visit Etymon's Homepage

Thanks for the reply, Richard. If you ever come across a fix for NN, please remember me.

Etymon

Go to Top of Page

Etymon
Advanced Member

United States
2385 Posts

Posted - 09 July 2002 :  14:06:49  Show Profile  Visit Etymon's Homepage
quote:


Thanks for the reply, Richard. If you ever come across a fix for NN, please remember me.

Etymon




I found that the Netscape browser itself does not have the capability to do this. Rumor has it that Netscape 6.x may or may not be able to do it. Just a limitation of that particular browser.

Etymon



Edited by - Etymon on 09 July 2002 14:07:41
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.24 seconds. Powered By: Snitz Forums 2000 Version 3.4.07