好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

html5教程-要求在H5中写一个下拉框,点击下拉框内容会出现在文本域中(代码详解)

小宝典致力于为广大程序猿(媛)提供高品质的代码服务,请大家多多光顾小站,小宝典在此谢过。

朋友 出去面试做的面试题,分享了下,我就拿来做做。原题:

HTML 中有个下拉框,包含[风,雨,雷, 电 ], 添加事件 ,当选择风时, 文本域 内出现选择

 <!DOCTY PE  ht ML >   <html lang="en">   <head>       < ;m eta charset="UTF-8">       <t IT le>Title</title>   </head>   <body>   <form n am e="form_name" >       <select name="select_name"   onChange="ShowToText(); "  >           <option value="1">风</option>           <option value="2">雨</option>           <option value="3">雷</option>           <option value="4">电</option>       </select>< br >          <textarea rows="3" cols="30"name="textfield_name3">       </textarea>   </form>   </body>   <script language="JavaScript">       function ShowToText(){           document.form_name.textfield_name3.value=document.form_name.select_name.options[document.form_name.select_name.selectedIndex].text       }   </script>   </html>  

运行效果

朋友出去面试做的面试题,分享了下,我就拿来做做。原题:

HTML中有个下拉框,包含[风,雨,雷,电],添加事件,当选择风时,文本域内出现选择

 <!DOCTYPE html>   <html lang="en">   <head>       <meta charset="UTF-8">       <title>Title</title>   </head>   <body>   <form name="form_name" >       <select name="select_name"   onChange="ShowToText(); "  >           <option value="1">风</option>           <option value="2">雨</option>           <option value="3">雷</option>           <option value="4">电</option>       </select><br>          <textarea rows="3" cols="30"name="textfield_name3">       </textarea>   </form>   </body>   <script language="JavaScript">       function ShowToText(){           document.form_name.textfield_name3.value=document.form_name.select_name.options[document.form_name.select_name.selectedIndex].text       }   </script>   </html>  

运行效果

觉得 可用,就经常来吧! 欢迎评论哦!&nbs p; html5教程 ,巧夺天工,精雕玉琢。小宝典献丑了!

总结

以上是 为你收集整理的 html5教程-要求在H5中写一个下拉框,点击下拉框内容会出现在文本域中(代码详解) 全部内容,希望文章能够帮你解决 html5教程-要求在H5中写一个下拉框,点击下拉框内容会出现在文本域中(代码详解) 所遇到的问题。

如果觉得 网站内容还不错, 推荐好友。

查看更多关于html5教程-要求在H5中写一个下拉框,点击下拉框内容会出现在文本域中(代码详解)的详细内容...

  阅读:52次