|
|
|
Drop Down List อยากทราบว่าให้พอกดเลือก Item แล้ว Linkไปหน้า .html อื่น อ่ะ ครับ |
|
|
|
|
|
|
|
จะต่อยังไงดีอ่าครับ ช่วยแนะนำหน่อยน่ะครับ
<script language="javascript" type="text/javascript">
<!--
function listboxchange1(p_index) {
//Clear Current options in subcategory1
document.form1.subcategory1.options.length = 0;
//Clear Current options in subcategory2
document.form1.subcategory2.options.length = 0;
document.form1.subcategory2.options[0] = new Option("Select Items", "");
switch (p_index) {
case "Product1":
document.form1.subcategory1.options[0] = new Option("Select Brands", "");
document.form1.subcategory1.options[1] = new Option("Brand1", "Brand1");
document.form1.subcategory1.options[2] = new Option("Brand2", "Brand2");
break;
case "Product2":
document.form1.subcategory1.options[0] = new Option("Select Brands", "");
document.form1.subcategory1.options[1] = new Option("Brand1", "Brand1");
document.form1.subcategory1.options[2] = new Option("Brand2", "Brand2");
break;
case "Product3":
document.form1.subcategory1.options[0] = new Option("Select Brands", "");
document.form1.subcategory1.options[1] = new Option("Brand1", "Brand1");
document.form1.subcategory1.options[2] = new Option("Brand2", "Brand2");
break;
case "Product4":
document.form1.subcategory1.options[0] = new Option("Select Brands", "");
document.form1.subcategory1.options[1] = new Option("Brand1", "Brand1");
document.form1.subcategory1.options[2] = new Option("Brand2", "Brand2");
break;
}
return true;
}
//-->
</script>
<script language="javascript" type="text/javascript">
<!--
function listboxchange(p_index) {
//Clear Current options in subcategory
document.form1.subcategory2.options.length = 0;
switch (p_index) {
case "Brand1":
document.form1.subcategory2.options[0] = new Option("Select Items", "");
document.form1.subcategory2.options[1] = new Option("Item1", "Item1");
document.form1.subcategory2.options[2] = new Option("Item2", "Item2");
document.form1.subcategory2.options[3] = new Option("Item3", "Item3");
break;
case "Brand2":
document.form1.subcategory2.options[0] = new Option("Select Items", "");
document.form1.subcategory2.options[1] = new Option("Item1", "Item1");
document.form1.subcategory2.options[2] = new Option("Item2", "Item2");
break;
}
return true;
}
//-->
</script>
Tag : HTML/CSS, JavaScript
|
|
|
|
|
|
Date :
2012-02-25 15:52:20 |
By :
ผู้ด้อยความรู้ |
View :
1744 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ส่วนของ From ใน <Body> ครับ
<form id="form1" name="form1" method="post" action="insertarticle.asp" onsubmit="return ValidateForm(); true">
<table width="76%" border="1" align="center" cellpadding="2" cellspacing="0">
<tr>
<td width="24%" align="right" valign="middle">
<p align="center"><strong>Products:</strong> </p>
</td>
<td width="76%" align="left" valign="middle">
<select name="category" id="category" onchange="javascript: listboxchange1(this.options[this.selectedIndex].value);">
<option value="">Select Products</option>
<option value="Product1">Product1</option>
<option value="Product2">Product2</option>
<option value="Product3">Product3</option>
<option value="Product4">Product4</option>
</select>
</td>
</tr>
<tr>
<td align="right" valign="middle">
<div align="center"><strong>Brands:</strong> </div></td>
<td align="left" valign="middle">
<script type="text/javascript" language="javascript">
<!--
document.write('<select name="subcategory1" onChange="javascript: listboxchange(this.options[this.selectedIndex].value);"><option value="">Select Brands</option></select>')
-->
</script>
</td>
</tr>
<tr>
<td align="right" valign="middle">
<div align="center"><strong>Items :</strong> </div></td>
<td align="left" valign="middle">
<script type="text/javascript" language="javascript">
<!--
document.write('<select name="subcategory2"><option value="">Select Items</option></select>')
-->
</script>
</td>
</tr>
</table>
</form>
|
|
|
|
|
Date :
2012-02-25 16:27:21 |
By :
ผู้ด้อยความรู้ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|