אשכול: [JS] שאלה..
View Single Post
ישן 07-08-06, 20:48   # 2
Unknown
חבר בקהילה
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
גיל: 36
הודעות: 189

Unknown לא מחובר  

בקשר לשאלה הראשונה:
קוד:
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..
  Reply With Quote