הוסטס - פורום אחסון האתרים הגדול בישראל

הוסטס - פורום אחסון האתרים הגדול בישראל (https://hosts.co.il/forums/index.php)
-   פורום תיכנות (https://hosts.co.il/forums/forumdisplay.php?f=14)
-   -   שאלה בקשר ל SELECT-index (https://hosts.co.il/forums/showthread.php?t=25185)

בניה 28-06-06 21:28

ב"ה


123 ו 1
האינדקסים מתחילים מ-0 כמו מערך.

miniature 28-06-06 21:34

מוזר שזה לא עובד..
אני אביא את הקוד המלא:
HTML קוד:

<span>
<select id="fontname" onchange="fontname(this)">
<option value="Arial" selected="selected">Arial</option>
<option value="Courier New">Courier New</option>
<option value="Georgia">Georgia</option>
<option value="Tahoma">Tahoma</option>
<option value="Times New Roman">Times New Roman</option>
<option value="Verdana">Verdana</option>
<option value="otherfont" style="color:#626262;">אחר...</option>
</select>
</span>

HTML קוד:

function fontname(fontname_i) {
  var fontname = fontname_i[fontname_i.selectedIndex].value;
  if(fontname != "none") {
    if(fontname == "otherfont") {
      otherfont();
    }
    else {
      document.getElementById('editor').focus();
      document.execCommand('fontname',false,fontname);
      document.getElementById('editor').focus();
    }
  }
  else {
    document.getElementById('editor').focus();
  }
}


miniature 30-06-06 17:02

הקפצה. (יש אישור)

RS324 30-06-06 20:38

שאלה : אם הבנתי נכון, אתה מעוניין שבעת בחירה איזהשהו ערך מתוך ה SELECT, אז הוא יפעיל פונקציה מסוייימת על הערך נכון ?
אם כן יש לי סקריפט דיי דומה שאני משתמש בו הרבה זמן, מאד מאד פשוט ואני אדביק אותו פה.
רק תאשר לי שזה נכון מה שאמרתי

בניה 01-07-06 20:10

קוד:

<script>
function fontname(fontname_i) {
  var fontname = fontname_i.value;
  if(fontname != "none") {
    if(fontname == "otherfont") {
      otherfont();
    }
    else {
      document.getElementById('editor').focus();
      document.execCommand('fontname',false,fontname);
      document.getElementById('editor').focus();
    }
  }
  else {
    document.getElementById('editor').focus();
  }
}
</script>
<span>
<select id="fontname" onchange="fontname(this)">
<option value="Arial" selected="selected">Arial</option>
<option value="Courier New">Courier New</option>
<option value="Georgia">Georgia</option>
<option value="Tahoma">Tahoma</option>
<option value="Times New Roman">Times New Roman</option>
<option value="Verdana">Verdana</option>
<option value="otherfont" style="color:#626262;">&agrave;&ccedil;&oslash;...</option>
</select>
</span>

תנסה

miniature 01-07-06 23:04

לא עובד..
RS324 אשמח לראות את הקוד שלך.


כל הזמנים הם GMT +2. הזמן כעת הוא 17:21.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ