|
|
|
|
# 1 |
|
חבר בקהילה
|
בקשר לשאלה הראשונה:
קוד:
xxx.value.replace(REPLACEWHAT,REPLACE WITH); קצת ארוך מקווה שתבין הכל: קוד:
function is_ie() {
if (navigator.appName == "Microsoft Internet Explorer")
return true;
else
return false;
}
function text2color(text,c) {
txtElement = document.forms.myform.text;
if (is_ie()) {
txtElement.focus();
docSelection = document.selection;
txtSelection = docSelection.createRange();
if (txtSelection.text != "") {
txtSelection.text = '<font color="'+c+'">'+txtSelection.text+'</font>';
} else {
txtElement.value = '<font color="'+c+'">'+txtElement.value+'</font>';
}
} else {
txtElement.focus();
docSelection = txtElement.value.substring(txtElement.selectionStart, txtElement.selectionEnd);
if (docSelection != "") {
var newValue = "";
newValue += txtElement.value.substring(0, txtElement.selectionStart);
newValue += '<font color="'+c+'">'+docSelection+'</font>';
newValue += txtElement.value.substring(txtElement.selectionEnd, txtElement.value.length);
txtElement.value = newValue;
} else {
txtElement.value = '<font color="'+c+'">'+txtElement.value+'</font>';
}
}
}
__________________
מתכנת מקצועי (ידוע גם כUnknownGod) שנות נסיון רבות בפיתוח אתרים ואפליקציות WEB Last edited by Unknown; 07-08-06 at 20:51.. |
|
|
|
# 2 |
|
הוסטסניון
|
תודה:)
הראשון עזר לי השני גם עובד אבל לא ממש הבנתי..
הבנתי חצי , את הקטע של האחרי הבדיקה של הדפדפן לא הבנתי.. את זה: HTML קוד:
txtElement.focus();
docSelection = document.selection;
txtSelection = docSelection.createRange();
if (txtSelection.text != "") {
txtSelection.text = '<font color="'+c+'">'+txtSelection.text+'</font>';
} else {
txtElement.value = '<font color="'+c+'">'+text+'</font>';
}
תודה ![]()
__________________
אימיל \ מסן : amirs91 [at] gmail.com |
|
![]() |
| חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים) | |
|
|