菜鸟教程
https://www.runoob.com/bootstrap/bootstrap-forms.html
https://www.runoob.com/try/try.php?filename=bootstrap3-plugin-modal
2.实现代码如下
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Bootstrap 实例 - 模态框(Modal)插件</title>
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<h2>创建模态框(Modal)</h2>
<!-- 按钮触发模态框 -->
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal-login">
立即登录
</button>
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal-register">
立即注册
</button>
<!-- 模态框(Modal) -->
<div class="modal fade" id="myModal-login" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"
style="width: 680px;height: 640px;margin: 0 auto;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
×
</button>
<h4 class="modal-title" id="myModalLabel">
登录
</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="loginForm" name="loginForm"
action="${path}/login.do" method="post" onsubmit="return logs('click')">
<div class="control-group">
<label class="control-label" for="Lcard_num">账号</label>
<div class="controls">
<input type="text" name="userName" id="Lcard_num"
style="height: 5%; margin-top: 3px; margin-right: 3px;"
required="required"><span id="Lcn">请输入账号!</span>
<!-- chrom ie11 input bug 5% height fixed it -->
</div>
</div>
<div class="control-group">
<label class="control-label" for="Lcard_pass">密码</label>
<div class="controls">
<input type="password" name="password" id="Lcard_pass"
style="height: 5%; margin-top: 3px; margin-right: 3px;"
required="required"><span id="Lcp">请输入密码!</span>
</div>
</div>
<div class="control-group">
<label class="control-label" for="Lcard_code">验证码</label>
<div class="controls">
<input type="text" name="code" id="Lcard_code"
style="height: 5%; margin-top: 3px; margin-right: 3px;width:100px;"
required="required">
<img id="imgcode" onclick="changeCode(this);" title="看不清,单击更换" alt="看不清,单击更换" style="display:none;width:80px;height:30px;cursor:pointer;">
<span id="Lcd">请输入验证码!</span>
</div>
</div>
<div class="control-group">
<div class="controls">
<input type="submit" name="sub" id="loginSub" value="登录"
class="btn btn-danger btn-block" style="margin-left: -90px; height: 30px; *background: #f2000d;">
</div>
</div>
</form>
</div>
<!-- <div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭
</button>
<button type="button" class="btn btn-primary">
提交更改
</button>
</div> -->
</div><!-- /.modal-content -->
</div><!-- /.modal -->
</div>
<!-- 注册 -->
<div class="modal fade" id="myModal-register" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true" style="width: 680px;height: 640px;margin: 0 auto;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">注册(用户)</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="signForm" name="signForm"
action="${path}/sign.do" method="post">
<div class="control-group">
<label class="control-label" for="Scard_num">账号</label>
<div class="controls">
<input type="text" name="userName" id="Scard_num"
style="height: 5%; margin-top: 3px; margin-right: 3px;"
required="required" maxlength="10"><span id="Lcn">请输入账号!</span>
<!-- chrom ie11 input bug 5% height fixed it -->
</div>
</div>
<div class="control-group">
<label class="control-label" for="Scard_pass">密码</label>
<div class="controls">
<input type="password" name="password" id="Scard_pass"
style="height: 5%; margin-top: 3px; margin-right: 3px;"
required="required"><span id="Lcp">请输入密码!</span>
</div>
</div>
<div class="control-group">
<label class="control-label" for="Scard_grade">年级</label>
<div class="controls">
<select name="grade" id="Scard_grade"
style="height: 5%; margin-top: 3px; margin-right: 3px;"
required="required">
<option value="2022">2022</option>
<option value="2021">2021</option>
<option value="2020">2020</option>
<option value="2019">2019</option>
<option value="2018" selected="selected">2018</option>
<option value="2017">2017</option>
<option value="2016">2016</option>
<option value="2015">2015</option>
</select>
<span id="Lcd">请选择年级!</span>
</div>
</div>
<div class="control-group">
<label class="control-label" for="Scard_name">姓名</label>
<div class="controls">
<input type="text" name="name" id="Scard_name"
style="height: 5%; margin-top: 3px; margin-right: 3px;"
required="required"><span id="Lcp">请输入姓名!</span>
</div>
</div>
<div class="control-group">
<label class="control-label" for="Scard_telphone">电话</label>
<div class="controls">
<input type="text" name="telPhone" id="Scard_telphone"
style="height: 5%; margin-top: 3px; margin-right: 3px;"
required="required"><span id="Lcp">请输入电话!</span>
</div>
</div>
<div class="control-group">
<label class="control-label" for="Scard_email">邮箱</label>
<div class="controls">
<input type="text" name="email" id="Scard_email"
style="height: 5%; margin-top: 3px; margin-right: 3px;"
required="required"><span id="Lcp">请输入邮箱!</span>
</div>
</div>
<div class="control-group">
<label class="control-label" for="Scard_qq">QQ</label>
<div class="controls">
<input type="text" name="qq" id="Scard_qq"
style="height: 5%; margin-top: 3px; margin-right: 3px;"
required="required"><span id="Lcp">请输入QQ!</span>
</div>
</div>
<div class="control-group">
<div class="controls">
<input type="submit" name="sign" id="SignSub" value="注册"
class="btn btn-danger btn-block" style="margin-left: -90px; height: 30px; *background: #f2000d;">
</div>
</div>
</form>
</div>
<!-- <div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭
</button>
<button type="button" name="sign" id="SignSub" value="注册" class="btn btn-primary">注册</button>
</div> -->
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal -->
</div>
</body>
</html>
bootstrap-href触发模态弹出窗元素
于 2022-02-20 15:02:03 首次发布