実装
最初のPHPドロップダウンボックスの実装方法:
- <?php
- // ドロップダウンボックスを送信
- // onchange イベントの結果を直接トリガーします
- $id =$_GET['myselect']; // myselect
は location.herf?id の名前です - // フォームを使用して送信された結果if($_POST ["sendSelect"]){ //sendSelect はフォームの名前です
- $select_val
- =$_POST["selectID"];選択した値: $select_val ";
href- = del_03.php?
- id
- =
'.$xing.' &- アクション=' .$ファング。' >
- flx</a>
- '; /phpでコンテンツ削除時にプロンプトが表示される 書き方; href の後には引用符が必要です echo "n"." input ='ボタン' 値='削除'
onclick="if(confirm('削除してもよろしいですか')) { location .href='?delete=$result_manage[p_id]'}"> br - ><
- br>”; 入力 type=
'ボタン' 値='connect_next' onclick="location.href='del_03.php?id=
$xing&action=$fang'" > ";
-
&? & Gt;
2 番目の pHP ドロップダウン ボックス 実装方法を選択します。
<ol class="dp-xml">
<li class="alt"><span><span class="tag"><</span><span> </span><span class="tag-name">input</span><span> </span><span class="attribute">type</span><span>=</span><span class="attribute-value">"button"</span><span> </span><span class="attribute">value</span><span>=</span><span class="attribute-value">"delete"</span><span> </span><span class="attribute">onclick</span><span>=</span><span class="attribute-value">"<br />if(confirm('确定要删除吗')) location.href=<br />'del_03.php?id=xing'"</span><span class="tag">></span><span class="tag"><</span><span> </span><span class="tag-name">br</span><span class="tag">/></span><span> </span></span></li>
<li>
<span class="tag"><</span><span> </span><span class="tag-name">script</span><span> </span><span class="attribute">language</span><span>=</span><span class="attribute-value">"JavaScript"</span><span> </span><span class="attribute">type</span><span>=</span><span class="attribute-value">"text/javascript"</span><span class="tag">></span><span> </span>
</li>
<li class="alt"><span>function select(obj){ </span></li>
<li>
<span class="attribute">window.location.href</span><span>=</span><span class="attribute-value">'del_04.php?myselect=<br>'</span><span>+obj.options[obj.selectedIndex].value; </span>
</li>
<li class="alt"><span>return; //可以不写; </span></li>
<li><span>} </span></li>
<li class="alt">
<span class="tag"><</span><span> /script</span><span class="tag">></span><span> </span>
</li>
<li>
<span class="tag"><</span><span> </span><span class="tag-name">input</span><span> </span><span class="attribute">type</span><span>=</span><span class="attribute-value">"button"</span><span> </span><span class="attribute">value</span><span>=</span><span class="attribute-value">"delete"</span><span> <br /></span><span class="attribute">onclick</span><span>=</span><span class="attribute-value">"if(confirm('确定要删除吗')) <br />location.href='del_03.php?id=xing'"</span><span class="tag">></span><span class="tag"><</span><span> </span><span class="tag-name">br</span><span class="tag">/></span><span> </span>
</li>
<li class="alt">
<span class="tag"><</span><span> </span><span class="tag-name">form</span><span> </span><span class="attribute">name</span><span>=</span><span class="attribute-value">"myform"</span><span> </span><span class="attribute">action</span><span>=</span><span class="attribute-value">"del_04.php"</span><span> <br /></span><span class="attribute">method</span><span>=</span><span class="attribute-value">"post"</span><span class="tag">></span><span> </span>
</li>
<li>
<span class="tag"><</span><span> !-- 直接触发onchange 事件 ,此时不用提交表单,-- </span><span class="tag">></span><span> </span>
</li>
<li class="alt">
<span class="tag"><</span><span> !--</span><span class="tag"><</span><span> </span><span class="tag-name">select</span><span> </span><span class="attribute">name</span><span>=</span><span class="attribute-value">"selectID"</span><span> </span><span class="attribute">onchange</span><span>=<br /></span><span class="attribute-value">"location='del_04.php?myselect='+this.options<br />[this.selectedIndex].value"</span><span class="tag">></span><span>--</span><span class="tag">></span><span> </span>
</li>
<li>
<span class="tag"><</span><span> !-- 把onchange 的事件写在一个函数里面-- </span><span class="tag">></span><span> </span>
</li>
<li class="alt">
<span class="tag"><</span><span> </span><span class="tag-name">select</span><span> </span><span class="attribute">name</span><span>=</span><span class="attribute-value">"selectID"</span><span> </span><span class="attribute">onchange</span><span>=</span><span class="attribute-value">"select(this)"</span><span class="tag">></span><span> </span>
</li>
<li>
<span class="tag"><</span><span> !-- </span><span class="tag"><</span><span> </span><span class="tag-name">select</span><span> </span><span class="attribute">name</span><span>=</span><span class="attribute-value">"selectID"</span><span> </span><span class="tag">></span><span>--</span><span class="tag">></span><span> </span>
</li>
<li class="alt">
<span class="tag"><</span><span> </span><span class="tag-name">option</span><span> </span><span class="attribute">value</span><span>=</span><span class="attribute-value">"0"</span><span class="tag">></span><span>请选择</span><span class="tag"><</span><span> /option</span><span class="tag">></span><span> </span>
</li>
<li>
<span class="tag"><</span><span> </span><span class="tag-name">option</span><span> </span><span class="attribute">value</span><span>=</span><span class="attribute-value">"value1"</span><span class="tag">></span><span>option1</span><span class="tag"><</span><span> /option</span><span class="tag">></span><span> </span>
</li>
<li class="alt">
<span class="tag"><</span><span> </span><span class="tag-name">option</span><span> </span><span class="attribute">value</span><span>=</span><span class="attribute-value">"value2"</span><span class="tag">></span><span>option2</span><span class="tag"><</span><span> /option</span><span class="tag">></span><span> </span>
</li>
<li>
<span class="tag"><</span><span> </span><span class="tag-name">option</span><span> </span><span class="attribute">value</span><span>=</span><span class="attribute-value">"value3"</span><span class="tag">></span><span>option3</span><span class="tag"><</span><span> /option</span><span class="tag">></span><span> </span>
</li>
<li class="alt">
<span class="tag"><</span><span> /select</span><span class="tag">></span><span> </span>
</li>
<li>
<span class="tag"><</span><span> </span><span class="tag-name">input</span><span> </span><span class="attribute">type</span><span>=</span><span class="attribute-value">"submit"</span><span> </span><span class="attribute">name</span><span>=</span><span class="attribute-value">"sendSelect"</span><span> <br /></span><span class="attribute">value</span><span>=</span><span class="attribute-value">"提交下拉框"</span><span class="tag">/></span><span> </span>
</li>
<li class="alt">
<span class="tag"><</span><span> /form</span><span class="tag">></span><span> </span>
</li>
</ol>
ログイン後にコピー
以上がその2つですPHP ドロップダウン ボックスの実装メソッド。
http://www.bkjia.com/PHPjc/445968.html
www.bkjia.com
true
http://www.bkjia.com/PHPjc/445968.html
技術記事🎜🎜🎜
🎜🎜