唉,好久没写前端代码,有点生疏了,直接贴代码, 需引入jquery
<!DOCTYPE html> <html> <head> <title>Index</title>
<script src="/Scripts/jquery-1.4.4.min.js" type="text/javascript"></script> </head> <body> <h2>Index</h2> <form action="/home/Search" id="form1"> <span style="250px; position:relative; top:-13px; display:inline-block"> <select style="250px;height:21px; position:absolute;left:0px;top:0px; " onchange="setValue(this)"> <option value="111" selected>111</option> <option value="222" >222</option> <option value="333" >333</option> <option value="444" >444</option> </select> <input name="rjejectReason1" id="rjejectReason1" style="232px;position:absolute;left:0px;top:0px; height:15px;" /> </span> <script type="text/javascript"> function setValue(obj) { var text = $(obj).siblings().eq(0); $(text).focus(); $(text).attr('value', obj.value + ':'); } </script> <input type="submit" value="Submit" /> </form> </body> </html>