【发布时间】:2013-12-12 18:35:56
【问题描述】:
我有几个单选按钮。在选择其中一个并提交时,它将重定向到与该选项对应的特定页面。
我用谷歌搜索了很多,但似乎无法摆脱两个问题。
- 选择一个单选按钮,然后提交重定向。
- 垂直对齐页面中心的按钮。
这是代码 -
<style type="text/css">
body {
background-color: #333;
}
body,td,th {
font-family: "Arial Black", Gadget, sans-serif;
}
form{display:inline;
}
.block{
position:absolute;
top:50%
}
.wrapper{
text-align:center;
}
</style>
HTML -
<body>
<h1 align="center">Menu</h1>
<p> </p>
<p align="center"> </p>
<form id="form2" name="form2" method="post" action="" >
<div class="wrapper">
<label class="block"><input type="radio" name="Radio Buttons" value="radio" id="RadioButtons_0"/>Options112</label>
</div>
<div class="wrapper">
<label class="block"><input type="radio" name="Radio Buttons" value="radio" id="RadioButtons_1" />
Option2</label>
</div>
<div class="wrapper">
<label class="block"><input type="radio" name="Radio Buttons" value="radio" id="RadioButtons_2" style="display:inline-block"/>
Option3</label>
</div>
</form>
<form id="form1" name="form1" method="post" action="">
<br/>
<div align="center">
<input type="submit" name="Submit" id="Submit" value="Submit" />
<input type="submit" name="Contribute" id="Contribute" value="Contribute" />
</div>
</form>
</body>
限制是使用javascript。
【问题讨论】:
-
首先你没有关闭你的 div也改变块类位置的css:相对
标签: javascript html css