怎么在JSP中设置BUTTON的大小?

怎么在JSP中设置BUTTON的大小?,第1张

如何在JSP中设置BUTTON的大小

请问下如何在JSP中设置BUTTON的大小,我这样设置的,但是不行 <input   。

type= "Button "   value= "确定 "   name= "login1 "   height= "100 "  。 

width= "500 ">。

<input type= "button " style= "height:50pxwidth:120px ">。

button 的样式或者大小需要使用css来控制的比如style="width:200px"。

jsp里设置按钮或者表格的位置可以通过div进行调整

用绝对定位还是要相对定位,参数如下:

Relative 相对定位:left 和top

position: relative/*相对定位*/

left:40px/*在原来的位置向右移动*/

top:100px/*在原来的位置向下移动*/

他的参照点是他原来位置

Absolute 绝对定位:元素从原来的位置脱离,让出原来的空间,同时相对于他所

存在的离自己最近的非标准流的盒子而言的

position: absolute/*绝对定位*/

left:40px/*在原来的位置向右移动*/

top:100px/*在原来的位置向下移动*/

他的参照点是他原来位置

Fixed 只根据body的绝对定位

jsp中的单选按钮通常是radio,所以通过js来设置这个默认选中状态即可。

参考代码如下:

<html>

<head>

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

</head>

<body>

<div>

<input id="rdo1" name="rdo1" type="radio" value="1" checked="checked"/>是

<input id="rdo1" name="rdo1" type="radio" value="0"/>否

<button id="btn1">是</button>

<button id="btn2">否</button>

<div>

<script type="text/javascript">

$(function(){

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

$("input[name='rdo1']").eq(0).attr("checked","checked")

$("input[name='rdo1']").eq(1).removeAttr("checked")

$("input[name='rdo1']").eq(0).click()

})

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

$("input[name='rdo1']").eq(0).removeAttr("checked")

$("input[name='rdo1']").eq(1).attr("checked","checked")

$("input[name='rdo1']").eq(1).click()

})

})

</script>

</body>

</html>


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

原文地址: https://outofmemory.cn/tougao/11044737.html

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

发表评论

登录后才能评论

评论列表(0条)

保存