中国开发网: 论坛: 程序员情感CBD: 贴子 418201
nostalgic: JS&HTML
index.html
**********************************************************

<html>
<head>
<title>infomation</title>
<script language="javascript">
function pageonload(){
var list=document.getElementById("age");
list.length=2;
list.options[0].text = "8--15";
list.options[0].value = "8--15";
list.options[1].text = "16--23";
list.options[1].value = "16--23";
}

function isVIP(){
var objF = document.getElementById("use");
var objCheck = document.getElementById("vip");
if (objCheck.checked) {
objF.innerHTML = "VIP userID";
} else{
objF.innerHTML = "userID";
}
}

function viewDeitel(){
var str = document.getElementById("hiddenDes").value;

var url = "deitel.html";

window.showModalDialog(url,str,'dialogwidth=500px; dialogheight=300px;status=no; help=no');
}

function getDeitelInfomation(){
var str = document.getElementById("hiddenDes").value;

var url = "deitel.html";

window.showModalDialog(url,str,'dialogwidth=500px; dialogheight=300px;status=no; help=no');
}

function reg(){
var arr=document.getElementsByName("sex");
for(var i=0;i<arr.length;i++){
if(arr[i].checked){
if(arr[i].value=="1"){
document.getElementById("writeSex").value='man';
}
else{
document.getElementById("writeSex").value='female';
}
}
}
if(document.getElementById("userID").value!=""){
if(document.getElementById("password").value!=""){
document.getElementById("result").style.display="block";
document.getElementById("writeUserID").value = document.getElementById("userID").value;
document.getElementById("writePassword").value = document.getElementById("password").value;
if(document.getElementById("inputAge").checked){
alert("in put age");
document.getElementById("writeAge").value = document.getElementById("age1").value;
}
else{
document.getElementById("writeAge").value = document.getElementById("age").value;
}

}
else{
alert("the password is null");
return false;
}
}
else{
alert("the userID is null");
return false;
}

}

function cleanDeitel(){
document.all.hiddenDes.value="";
}
function cleanData(){
myForm.reset();
document.getElementById("result").style.display="none";
}

function putAge(){
var temp=document.getElementById("inputAge");
if(temp.checked){
alert("please in put age");
document.getElementById("age1").style.display='block';
document.getElementById("age").style.display='none';
}
else{
alert("please choose age");
document.getElementById("age1").style.display='none';
document.getElementById("age").style.display='block';
}
}

</script>
</head>
<body onLoad="pageonload();">
<form method="" action="" name="myForm">
<table width="649" border="1">
<tr>
<td colspan="2" align="center"> infomation
</tr>
<tr>
<td width="203" id="use">userID</td>
<td width="430">
<input type="text" name="userID" id="userID" />
<input type="checkbox" name="vip" id="vip" value="1" onClick="isVIP();"/>
VIP
</td>
</tr>
<tr>
<td width="203">age</td>
<td width="430"><select name="age" id="age"></select>
<input type="text" name="age1" id="age1" style="display: none" />
<input type="checkbox" name="inputAge" id="inputAge" value="1" onClick="putAge();"/> no data for choose
</td>
</tr>
<tr>
<td>sex</td>
<td>
<input type="radio" name="sex" value="1" checked/>man

<input type="radio" name="sex" value="0" />
female</td>
</tr>
<tr>
<td>password</td>
<td>
<input name="password" type="password" id="password" maxlength="5"/>
</td>
</tr>
<tr style="display: block">
<td>hiddenDes</td>
<td>
<textarea name="hiddenDes" id="hiddenDes" onClick="cleanDeitel();">this is a good guy</textarea>
</td>
</tr>
<tr>
<td>deitel</td>
<td>
<input type="button" name="view" value="view deitel" onClick="viewDeitel();"/>
</td>
</tr>
</table>
<p>
<table>
<tr>
<td align="center">
<input type="button" name="makeSure" value="submit" onClick="reg();"/>&nbsp;&nbsp;
<input type="button" name="reSet" value="reSet" onclick="cleanData();"/>
</td>
</tr>
</table>
<table id="result" name="result" style="display:none">
<tr>
<td colspan="2" align="center"> success</td>
</tr>
<tr>
<td>userID</td>
<td>age</td>
<td>sex</td>
<td>password</td>
<td>deitel</td>
</tr>
<tr>
<td><input type="text" name="writeUserID" id="writeUserID" /> </td>
<td><input type="text" name="writeAge" id="writeAge" /> </td>
<td><input type="text" name="writeSex" id="writeSex" /> </td>
<td><input type="text" name="writePassword" id="writePassword" /> </td>
<td><input type="button" name="getDeitel" id="getDeitel" value="getDeitel" onClick="getDeitelInfomation();" /> </td>
</tr>
</table>
</form>
<body>
<html>


deteil.html

*************************************************

<html>
<head>
<title>infomation</title>
<script language="javascript">
function ini(){
var str = window.dialogArguments;
document.getElementById("infomation").value = str;
}

</script>
<head>
<body onLoad="ini();">
<table width="100%" height="100" border="0" align="center" class="Mb_Table">
<tr>
<td align="center" valign="top" class="title">infomation</td>
</tr>
<tr>
<td align="center" valign="top"><textarea name="infomation" rows="13" id="infomation" cols="100"
style="width:100%"></textarea></td>
</tr>
<tr>
<td align="center" valign="top"><BUTTON onclick="window.close()">关 闭</BUTTON></td>
</tr>
</table>
</body>
</html>

相关信息:


欢迎光临本社区,您还没有登录,不能发贴子。请在 这里登录