日期:2014-05-18  浏览次数:20689 次

求一个JS弹出框的制作代码
jsp里点击事件跳出一个弹出框
上面有三个单选按钮跟一些说明文字
还有一个确定一个取消按钮
选择单选按钮然后点确定,可以提交给.do
取消按钮关闭这个弹出框


------解决方案--------------------
<script>
function ff()
{
var jj = window.showModelDialog( "a.jsp ",window, "一堆的参数,大小高底等 ");
}
</scritp>
<input type= "button " onclick= "ff() " value= "打开窗口 ">


a.jsp

<head>
<base target= "_self ">
</head>


<form name= "aa " action= "XXXXXXXXX.do ">
<input type= "radio " name= "ff " checked> //默认选中
<input type= "radio " name= "ff " >
<input type= "radio " name= "ff " >
<input type= "submit " value= "确定 ">
<input type= "button " value= "取消 " onclick= "winodw.close();return false; ">
</form>
------解决方案--------------------
main.html:
<html>
<head>
<script>
function openWindow(){
window.open( "window.html ");
}
</script>
</head>

<body>
<form id= "form1 " name= "form1 " method= "post " action= " ">
<label> Click will open window
<input type= "button " name= "OpenWindow " value= "Open Window " onclick= "openWindow() "/>
</label>
</form>
</body>
</html>


window.html:
<html>
<head>
<script>
function send(){
var radiogroup=document.formname.radioname;
var radioLength=document.formname.radioname.length;
var url= "*.do? ";
if(radioLength==0){
alert( "Please select at least one radio ");
}else{
for(var i=0;i <radioLength;i++){
if(radiogroup[i].checked){
url+= "radiovalue= "+radiogroup[i].value;
}
}
}
alert(url);
document.location=url;
}

</script>
</head>

<body>
<form id= "formid " name= "formname " method= "post " action= " ">

<input name= "radioname " type= "radio " value= "value1 " />
Radio1
<input name= "radioname " type= "radio " value= "value2 " />
Radio2
<input name= "radioname " type= "radio " value= "value3 " />
Radio3
<br />
<input name= "Ok " type= "button " value= "OK " onclick= "send() "/>
<input name= "cancel " type= "button " value= "Cancel " onclick= "window.close(); "/>
</form>
</body>
</html>