jsp点按钮出来一个下拉表单

jsp点按钮出来一个下拉表单,第1张

//简单实现了下,参考下吧

<!DOCTYPE html>

<html>

<head>

 <title>test</title>

 <meta httpEquiv="Content-Type" content="text/html charset=utf-8" />

 <meta http-equiv="X-UA-Compatible" content="IE=EDGE" />

 <meta http-equiv="Pragma" content="no-cache" />

 <meta http-equiv="Cache-Control" content="no-cache" />

 <meta http-equiv="Expires" content="亩缓梁0" />

 <script type="text/javascript" src="./jquery.js"></script>

//自己下载个jquery文件

<哪余/head>

<style>

body{

 padding-bottom:0 !important

}

#div-one{

 width:100px

 height:100px

 background:red

 display:none

 position:relative

 left:40px

 top:0px

}

#more{

 width:40px

 height:20px

}

</style>

<script type="text/javascript">

$(function(){

 $("#more").click(function(){

  $("#div-one").show()

 })//点击更多响应事件

 $("#div-one").mouseleave(function(){

  var $input = $("input[name='more']")

  var arr = new Array()

  for(var i = 0 i<$input.length  i++){

   if($input[i].checked){

    arr.push( $input[i].value)

   }  

  }

  arr = arr.join(",")

  $("#div-one").hide()

  alert(arr)

 })

})

</script>

<body>

    <div class="screenDiv">

     <input type="button" id="more" value="更多"/>  

     <div id="div-one">

   <ul>

    <li><input type="checkbox" name ="more" id="id1" value="1"/><label for="id1"> 工号</label></li>

    <li><input type="checkbox" name ="more"  id="id2"  value="2"/><label for="id2">交易号<label</li>

    <li><input type="checkbox"  迅运name ="more"  id="id3" value="3"/><label for="id3">IP地址<label</li>

   </ul>

  </div>

  

    </div>

</body>

</html>

在jsp页面中用ajax无刷新提交缓型滑action,返回的时候拼接html显示到页面租态上。ajax的写法:$.ajax({

type:'post',//可选get

url:'action.php',//这里是接收数据的PHP程序

data:'data='dsa'',//传给PHP的数据,多个参数用&连接

dataType:'text',//服务器返回的数据类型 可选XML ,Json jsonp script html text等

success:function(msg){

//这里是ajax提交成功后,PHP程序返回的数据处理函数。msg是返回的扰腊数据,数据类型在dataType参数里定义!

},

error:function(){

ajax提交失败的处理函数!

}

})

<form method = 'post' action = '自己的action路径'>

<input type="submit" value="消衫喊提交" />

</form>

method = 'post'或拿野者get,这是最简单的form表单,通过提交按钮提交,你也可以自己写提塌缓交


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/bake/11974189.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-20
下一篇2023-05-20

发表评论

登录后才能评论

评论列表(0条)

    保存