跳到主要內容

動態變更事件函數

因為供應型態的變更,會影響查詢選單的內容。為使用者方便,我們會使用到動態變更的方法來達成。
HTML

採購(INPUT TYPE='radio' id='purchase' name='purchase' value='0' onclick='change_menu(this)' checked)

製程(INPUT TYPE='radio' id='workcenter' name='purchase' onclick='change_menu(this)' value='1')

提供單位:(INPUT TYPE='text' id='supply_id' style='width:90px' ondblclick='search_supply(this)')

Javascript

function change_menu(topost) {
  if (topost.id == 'purchase') {
    node('supply_id').ondblclick = new Function("search_supply(this)");
  } else {
    node('supply_id').ondblclick = new Function("menu_terms(this, '1')");
  }
}

如果變更的Function 不需要參數,則直接填入Function 名稱即可。如:

function change_menu(topost) {
  if (topost.id == 'purchase') {
    node('supply_id').ondblclick = search_supply;
  } else {
    node('supply_id').ondblclick = menu_terms;
  }
}

留言

這個網誌中的熱門文章

安裝webmin

Webmin是一套透過網頁的界面來維護linux主機各項伺服器的程式,非常的好用方便。 其安裝方式如下: 1. 在yum.repos.d資料夾下新增一個設定檔。     vi /etc/yum.repos.d/webmin.repo     [Webmin]       name=Webmin Distribution Neutral       baseurl=http://download.webmin.com/download/yum       enabled=1 2. 匯入GPGkey     rpm --import http://www.webmin.com/jcameron-key.asc     如果系統顯示匯入失敗。可改下列做法     wget http://www.webmin.com/jcameron-key.asc     rpm --import jcameron-key.asc 3. 執行安裝     yum install -y webmin 4. 設定使用者及密碼     /usr/libexec/webmin/changepass.pl /etc/webmin 帳號 密碼

CSS 文字效果

text-decoration 於 CSS 中定義為設定 文字效果 屬性有: 1. none ─ 預設值 2. overline ─ 文字標上線 3. underline ─ 文字標底線 4. line-throughx ─ 文字標刪除線 5. blink ─ 文字閃爍

安裝CKEditor 4.11

下載路徑 https://ckeditor.com/ckeditor-4/download/ 選擇版本 安裝到網站 將下載的資料夾移至網站目錄。 下載路徑 網站目錄 html檔案內容 <script src="CKEditor路徑/ckeditor.js"></script> <form><code class="prettyprint">內容:<textarea id="ckedit"></textarea></code></form> <script>CKEDITOR.replace('ckedit');</script> 呈現結果 設定toolbar 見到如此煩雜的工具列,看了就是不舒服。 有些工具其實也不必用到,只要在config.js檔設定一些內容,就可以有清爽的工具列了。 config.toolbar = 'Full'; config.toolbar_Full = [ { name: 'document', items : [ 'Source'] }, { name: 'basicstyles', items : [ 'Bold','Italic','Underline','Subscript','Superscript' ] }, { name: 'paragraph', items : [ 'NumberedList','BulletedList','CreateDiv' ] }, { name: 'links', items : [ 'Link','Unlink' ] }, { name: 'insert', items : [ 'Image','Table...