|
|
|
สอบถามหน่อยครับ list menu แบบนี้เค้าเรียกว่าอะไร และ php สามารถทำได้หรือเปล่า ... move list menu item option |
|
|
|
|
|
|
|
Code (JavaScript)
<html>
<head>
<title>ThaiCreate.Com Add/Remove Items</title>
<script language="JavaScript">
function MoveOption(objSourceElement, objTargetElement) {
var aryTempSourceOptions = new Array();
var x = 0;
for (var i = 0; i < objSourceElement.length; i++) {
if (objSourceElement.options[i].selected) {
var intTargetLen = objTargetElement.length++;
objTargetElement.options[intTargetLen].text = objSourceElement.options[i].text;
objTargetElement.options[intTargetLen].value = objSourceElement.options[i].value;
}
else {
var objTempValues = new Object();
objTempValues.text = objSourceElement.options[i].text;
objTempValues.value = objSourceElement.options[i].value;
aryTempSourceOptions[x] = objTempValues;
x++;
}
}
objSourceElement.length = aryTempSourceOptions.length;
for (var i = 0; i < aryTempSourceOptions.length; i++) {
objSourceElement.options[i].text = aryTempSourceOptions[i].text;
objSourceElement.options[i].value = aryTempSourceOptions[i].value;
objSourceElement.options[i].selected = false;
}
}
function checkAllItems()
{
for (var i = 0; i < frmMain.ddlLeft.length; i++) {
frmMain.ddlLeft.options[i].selected = true;
}
for (var i = 0; i < frmMain.ddlRight.length; i++) {
frmMain.ddlRight.options[i].selected = true;
}
}
function removeAllItems()
{
for (var i = 0; i < frmMain.ddlLeft.length; i++) {
frmMain.ddlLeft.options[i].selected = false;
}
for (var i = 0; i < frmMain.ddlRight.length; i++) {
frmMain.ddlRight.options[i].selected = false;
}
}
</script>
</head>
<body onLoad="removeAllItems();">
<form name="frmMain" action="AddRemoveItems.php" method="post" onSubmit="checkAllItems();">
<table width="353" border="0" cellspacing="4" cellpadding="0">
<tr>
<td><div align="center"><b>Left</b></div></td>
<td rowspan="2"><div align="center">
<input type="button" name="MoveRight" value="Move To Right -> " style="width: 120px;" onClick="MoveOption(this.form.ddlLeft, this.form.ddlRight)">
<br>
<br>
<input type="button" name="MoveLeft" value=" <- Move To Left" style="width: 120px;" onClick="MoveOption(this.form.ddlRight, this.form.ddlLeft)">
</div></td>
<td><div align="center"><b>Right</b></div></td>
</tr>
<tr>
<td>
<select name="ddlLeft[]" id="ddlLeft" size="12" multiple style="width: 100px;">
<option value="Option 1">Option 1</option>
<option value="Option 2">Option 2</option>
<option value="Option 3">Option 3</option>
<option value="Option 4">Option 4</option>
<option value="Option 5">Option 5</option>
<option value="Option 6">Option 6</option>
<option value="Option 7">Option 7</option>
<option value="Option 8">Option 8</option>
</select>
</td>
<td>
<select name="ddlRight[]" id="ddlRight" size="12" multiple style="width: 100px;">
</select>
</td>
</tr>
</table>
<br>
<input name="btnSubmit" type="submit" id="btnSubmit" value="Submit">
</form></body></html>
</body>
</html>
Go to : Move Option List/ListMenu เทคนิคการทำเพิ่ม/ลบ/ย้าย Option Items ใน List Menu
|
|
|
|
|
Date :
2011-03-17 12:56:31 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณครับ คุณวิน
|
|
|
|
|
Date :
2011-03-17 14:00:57 |
By :
l0gin |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|