html点击按钮弹出页面获取值的实例代码

2023-09-10实例代码
101

html点击按钮弹出页面获取值的实例代码
代码一:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
function winOpen (strURL,strName,width,height){
theWindow = window.open (strURL,strName,"width="+width+" height="+height+" scrollbars=yes left="+(1024-width)/2+" top="+(768-height)/2);
if (theWindow.opener == null) theWindow.opener = window;
if (window.focus) theWindow.focus();
}
function save(){
alert(document.getElementById("tid").value);
alert(document.getElementById("tname").value);
}
</script>
</head>
<body>
<from action="xx.action" method="post">
<!--部门ID-->
<input type="hidden" name="typeid" id="tid" value="">

请选择部门名称:<input type="text" name="v_type_name" id="tname" size="30" value=""/>
<input type="button" name="select" value="选择..." onClick="javaScript:winOpen('list.html','列表',600,400)">

<input type="button" name="select" value="提交" onClick="javaScript:save()">
</from>
</body>
</html>
代码二:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<title></title>
<script type="text/javascript">
function checkIt(){
window.opener.document.getElementById("tid").value = document.getElementById("dicId").value; //把子窗口的值,赋值给父窗口
window.opener.document.getElementById("tname").value = document.getElementById("dicName").value; //把子窗口的值,赋值给父窗口
window.close();
}
function getDicName(dicId,strDicName){
document.getElementById("dicId").value = dicId;
document.getElementById("dicName").value = strDicName;
}
</script>
</head>
<body>
<from action="xx.action" method="post" id="myform" name="myform">
<input type="hidden" name="dicId" id="dicId">
<input type="hidden" name="dicName" id="dicName">

<INPUT TYPE="radio" NAME="type" onclick="getDicName('1','行政部')">行政部
<INPUT TYPE="radio" NAME="type" onclick="getDicName('2','人事部')">人事部
<INPUT TYPE="radio" NAME="type" onclick="getDicName('3','财政部')">财政部
<INPUT TYPE="radio" NAME="type" onclick="getDicName('4','研发部')">研发部
<INPUT TYPE="radio" NAME="type" onclick="getDicName('5','产品部')">产品部

<br/>
<input type='button' name='create' value=" 确 认 " onClick="javascript:checkIt()">
<input type='button' name="cancel" onClick="javaScript:window.close()" value=" 取 消 ">

</from>
</body>
</html>
 
The End

相关推荐

layui后台布局实例代码
layui后台布局的实例代码,以下是详细代码: !DOCTYPE htmlhtmlhead meta charset="utf-8" meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" titlelayout 后台大布局 - Layui/title link rel="stylesheet" ...
2025-10-15 实例代码
68

可自动切换的tab实例代码
可自动切换的tab实例代码,html代码如下: !-- tab标签代码begin --div class="tab1" id="tab1" div class="menu" ul li id="one1" onclick="setTab('one',1)"新闻/li li id="one2" onclick="setTab('one',2)"活动/li li id="one3" onclick="setTab('one',3)"...
2025-09-16 实例代码
114

php数据处理:数组根据某字段进行分组
php数据处理:数组根据某字段进行分组,实例代码如下: /** * @description:根据数据 * @param {dataArr:需要分组的数据;keyStr:分组依据} * @return: */ protected function dataGroup(array $dataArr,string $keyStr) :array { $newArr=[]; foreach ($data...
2025-06-12 实例代码
188

LayUI登录页面页设计实例
实例代码如下: !DOCTYPE htmlhtml lang="en" head meta charset="utf-8" link rel="stylesheet" href="layui/css/layui.css" style type="text/css" .container{ width: 420px; height: 320px; min-height: 320px; max-height: 320px; position: absolute; t...
2025-04-13 实例代码
234

MUI Picker Input设置默认时间回显实例代码
MUI Picker Input设置默认时间回显实例代码 mui('body').on('tap', '#begTime', function () { //日期选择 var dtPicker = new mui.DtPicker({ type: 'date' }); /*参数:'datetime'-完整日期视图(年月日时分) 'date'--年视图(年月日) 'time' --时间视图(时分...
2025-01-09 实例代码
139

layui实现带清除按钮的输入框
layui实现带清除按钮的输入框,首先html文件如下: !DOCTYPE htmlhtmlhead meta charset="utf-8" meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" title测试 - layui/title link rel="stylesheet" href="layui/css/lay...
2024-12-31 实例代码
200