How to display the item that the user has selected?

2007-07-29 6:46 pm
Lets say got 2 checkbox when user selected anyone, den it will display the item that the user has selected.Can use alert.

回答 (1)

2007-07-29 7:10 pm
✔ 最佳答案
On the checkbox,
type:
onClick="javascript: alert(this.value) "

OR, you may first create a function to check if the user check the checkbox or unselect it.

function XXX(what) {
if (what.checked == true) {
alert ("You have selected" + what.value);
} else {
// any action you like
}

input type="checkbox" ... onClick="XXX(this)"


收錄日期: 2021-04-13 00:53:50
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20070729000051KK01257

檢視 Wayback Machine 備份