我有一個複選框和一個文本框。 我已經使用struts標籤和如何使用JavaScript來包含struts html標記?
現在我需要驗證,如果複選框被選中,我應該灰色(禁用)文本框。如果未選中,則文本框中會顯示電話號碼。
我確實喜歡這個,我在點擊複選框時調用了一個java腳本,並且根據wheather複選框檢查了ix的innerHtml。
var status_check = document.getElementById(「line1Checked」)。checked;如果(status_check == true){ document.getElementById(「line1」)。readonly =「true」; } else { document.getElementById(「line1」)。readonly =「false」; }
如果選中該複選框,我只能使文本框爲只讀。 這是文本框是如何defiened,
請建議..
我得到了我的答案.. var status_check = document.getElementById(「line1Checked」)。checked; if(status_check == true){document.getElementById(「line1」)。readOnly =「true」; } else {document.getElementById(「line1」)。readOnly =「false」; } –
所有的struts標籤都會被轉換爲html標籤。所以我們可以使用這個 –