javascript 表单提交问题!!急急急急急!谢谢!!
<html><head><scriptlanguage=javascript></script><scripttype=text/javascript>functioni...
<html>
<head>
<script language=javascript></script>
<script type=text/javascript>
function inPutOpen(){
var str = document.getElementById('qwe').disabled;
str==true?(document.getElementById('qwe').disabled=false):(document.getElementById('qwe').disabled=true);}
function check(){
var str = document.getElementById('qwe').value;
var num = str.length;
var reg=/^[A-Fa-f0-9]+$/;
if( !reg.test( str ) ){
alert("对不起,你输入的范围必须是0-9|a-f|A-F");
return;}
if(num!=20){
alert("您的输入不满足20个字符的要求,请重新输入!");
document.getElementById('qwe').value='';
}else{
alert("输入成功,您输入的字符为:"+document.getElementById('qwe').value);}
}
</script>
</head>
<body>
<form method=post id=getElementByID>
<table width=450 class=body>
<tr><p><font size=2><b>
<input type="checkbox" id="tim" value="ON" onclick=inPutOpen()>开启</b></p><tr>
<tr><td><font size=2><b>号码:</b><input type="text" id="qwe" disabled>请输入数字或字母[a-f|A-F],必须输入20个字符!
</tr></td>
<p><input type="submit" value="提交" id="tijiao" size="12" onclick="check()" ></p>
</form> </table>
<form action= method=POST id="formFilterDel">
<table width=513 >
<tr><td width="507" class="titleCell"> <b>当前MAC地址过滤表:</b></tr></table>
<table border="0" width=500>
<tr><td align=center width="50%" bgcolor="#808080"><font size="2"><b>号码</b></font></td>
<td align=center width="20%" bgcolor="#808080"><font size="2"><b>是否删除</b></font></td></tr></table>
</form>
</body>
</html>
对输入的数据进行判断,正确的显示在下面列表中。列表还可以实现对数据删除功能( 删除前给出是否确定删除提示)。 展开
<head>
<script language=javascript></script>
<script type=text/javascript>
function inPutOpen(){
var str = document.getElementById('qwe').disabled;
str==true?(document.getElementById('qwe').disabled=false):(document.getElementById('qwe').disabled=true);}
function check(){
var str = document.getElementById('qwe').value;
var num = str.length;
var reg=/^[A-Fa-f0-9]+$/;
if( !reg.test( str ) ){
alert("对不起,你输入的范围必须是0-9|a-f|A-F");
return;}
if(num!=20){
alert("您的输入不满足20个字符的要求,请重新输入!");
document.getElementById('qwe').value='';
}else{
alert("输入成功,您输入的字符为:"+document.getElementById('qwe').value);}
}
</script>
</head>
<body>
<form method=post id=getElementByID>
<table width=450 class=body>
<tr><p><font size=2><b>
<input type="checkbox" id="tim" value="ON" onclick=inPutOpen()>开启</b></p><tr>
<tr><td><font size=2><b>号码:</b><input type="text" id="qwe" disabled>请输入数字或字母[a-f|A-F],必须输入20个字符!
</tr></td>
<p><input type="submit" value="提交" id="tijiao" size="12" onclick="check()" ></p>
</form> </table>
<form action= method=POST id="formFilterDel">
<table width=513 >
<tr><td width="507" class="titleCell"> <b>当前MAC地址过滤表:</b></tr></table>
<table border="0" width=500>
<tr><td align=center width="50%" bgcolor="#808080"><font size="2"><b>号码</b></font></td>
<td align=center width="20%" bgcolor="#808080"><font size="2"><b>是否删除</b></font></td></tr></table>
</form>
</body>
</html>
对输入的数据进行判断,正确的显示在下面列表中。列表还可以实现对数据删除功能( 删除前给出是否确定删除提示)。 展开
9个回答
展开全部
经过了严格的测试,在IE,Firefox下均可用.
用法:点击"开启",输入MAC地址,回车或点填加.
点"删除"再确认就可以删除了.
<html>
<head>
<script language=javascript>
</script>
<script type=text/javascript>
function openIn(flag){
var elem = document.getElementById('mac_in')
flag ? elem.disabled = false : elem.disabled = true;
}
function add(){
var mac_in = document.getElementById("mac_in");
var mac = mac_in.value;
if (!/^[A-Fa-f0-9]+$/.test(mac)) {
alert("对不起,你输入的范围必须是0-9|a-f|A-F");
focus();
return false;
}
if (mac.length != 20) {
alert("您的输入不满足20个字符的要求,请重新输入!");
var elem = document.getElementById('mac_in');
focus();
return false;
}
var tab = document.getElementById("macsTab").tBodies[1];
for (var i = 0; i < tab.rows.length; i++) {
if (tab.rows[i].cells[0].textContent.search(mac) >= 0) {
alert("这个地址已经存在了,请重新输入!")
focus();
return false;
}
}
var tr = tab.insertRow(-1);
var td = tr.insertCell(-1);
td.innerHTML = mac;
td = tr.insertCell(-1);
td.innerHTML = '<a href="javascript:void(null)" onclick="del(this.parentNode.parentNode.rowIndex)">删除</a>';
document.getElementById('mac_in').value = "";
function focus(){
var elem = document.getElementById('mac_in');
elem.focus();
elem.select();
}
}
function del(index){
if (confirm("确实要删除吗?")) {
document.getElementById("macsTab").deleteRow(index)
}
}
</script>
</head>
<body>
<form action="javascript:add();void(0)">
<input type="checkbox" onclick="openIn(this.checked)"/>开启<input type="text" id="mac_in" disabled="true" value="15412541256589545874"/>
<button type="submit">
填加
</button>
</form>
<form action= method=POST id="formFilterDel">
<table width=513 id="macsTab" border="1">
<tbody>
<tr>
<th colspan="2">
当前MAC地址过滤表:
</th>
</tr>
<tr>
<th>
号码
</th>
<th>
删除
</th>
</tr>
</tbody>
<tbody>
</tbody>
</table>
</form>
</body>
</html>
我的网站:http://www.everalan.com.cn
用法:点击"开启",输入MAC地址,回车或点填加.
点"删除"再确认就可以删除了.
<html>
<head>
<script language=javascript>
</script>
<script type=text/javascript>
function openIn(flag){
var elem = document.getElementById('mac_in')
flag ? elem.disabled = false : elem.disabled = true;
}
function add(){
var mac_in = document.getElementById("mac_in");
var mac = mac_in.value;
if (!/^[A-Fa-f0-9]+$/.test(mac)) {
alert("对不起,你输入的范围必须是0-9|a-f|A-F");
focus();
return false;
}
if (mac.length != 20) {
alert("您的输入不满足20个字符的要求,请重新输入!");
var elem = document.getElementById('mac_in');
focus();
return false;
}
var tab = document.getElementById("macsTab").tBodies[1];
for (var i = 0; i < tab.rows.length; i++) {
if (tab.rows[i].cells[0].textContent.search(mac) >= 0) {
alert("这个地址已经存在了,请重新输入!")
focus();
return false;
}
}
var tr = tab.insertRow(-1);
var td = tr.insertCell(-1);
td.innerHTML = mac;
td = tr.insertCell(-1);
td.innerHTML = '<a href="javascript:void(null)" onclick="del(this.parentNode.parentNode.rowIndex)">删除</a>';
document.getElementById('mac_in').value = "";
function focus(){
var elem = document.getElementById('mac_in');
elem.focus();
elem.select();
}
}
function del(index){
if (confirm("确实要删除吗?")) {
document.getElementById("macsTab").deleteRow(index)
}
}
</script>
</head>
<body>
<form action="javascript:add();void(0)">
<input type="checkbox" onclick="openIn(this.checked)"/>开启<input type="text" id="mac_in" disabled="true" value="15412541256589545874"/>
<button type="submit">
填加
</button>
</form>
<form action= method=POST id="formFilterDel">
<table width=513 id="macsTab" border="1">
<tbody>
<tr>
<th colspan="2">
当前MAC地址过滤表:
</th>
</tr>
<tr>
<th>
号码
</th>
<th>
删除
</th>
</tr>
</tbody>
<tbody>
</tbody>
</table>
</form>
</body>
</html>
我的网站:http://www.everalan.com.cn
展开全部
<html>
<head>
<script language=javascript>
function window.onunload(){
form.alltext.setAttribute("data",form.alltext.value);
form.alltext.save("cache");
}
function window.onload(){
form.alltext.load("cache");
if(form.alltext.getAttribute("data"));
form.alltext.value=form.alltext.getAttribute("data");
var num = document.getElementById("alltext").value.split('|').length-1;
for(i=0;i<num;i++)
{
document.getElementById("lt").innerHTML += document.getElementById("alltext").value.split('|')[i]+"<p>";
document.getElementById("dt").innerHTML += "<a href='javascript:deleterow("+ i +")'>删除</a>"+"<p>";
}
}
</script>
<script type=text/javascript>
function inPutOpen(){
var str = document.getElementById('qwe').disabled;
str==true?(document.getElementById('qwe').disabled=false):(document.getElementById('qwe').disabled=true);
}
function check(){
var str = document.getElementById('qwe').value;
var num = str.length;
var reg=new RegExp("^[A-Fa-f0-9]+$");
if( !reg.test( str ) ){
alert("对不起,你输入的范围必须是0-9|a-f|A-F");
return;}
if(num!=20){
alert("您的输入不满足20个字符的要求,请重新输入!");
document.getElementById('qwe').value='';
}else{
alert("输入成功,您输入的字符为:"+document.getElementById('qwe').value);
document.getElementById("alltext").value += document.getElementById('qwe').value+"|";
}
}
function deleterow(i){
var num = document.getElementById("alltext").value.split('|').length-1;
var arr = document.getElementById("alltext").value.split('|');
var tpstr = document.getElementById("alltext").value;
document.getElementById("alltext").value="";
for(j=0;j<num;j++)
{
if(j!=i)
document.getElementById("alltext").value += arr[j]+"|";
}
alert("删了");
window.location.reload();
}
</script>
</head>
<body>
<form method=post id=getElementByID>
<table width=450 class=body>
<tr><p><font size=2><b>
<input type="checkbox" id="tim" value="ON" onclick=inPutOpen()>开启</b></p><tr>
<tr><td><font size=2><b>号码:</b><input type="text" id="qwe" disabled>请输入数字或字母[a-f|A-F],必须输入20个字符!
</tr></td>
<p><input type="submit" value="提交" id="tijiao" size="12" onclick="check()" ></p>
</table>
</form>
<form action= method=POST id="formFilterDel" name="form">
<input type="text" id="alltext" readonly="true" style="VISIBILITY: hidden;behavior:url(#default#userdata)">
<table width=513>
<tr><td width=507 class=titleCell><b>当前MAC地址过滤表:</b></tr>
</table>
<table border="0" width=500>
<tr>
<td align=center width="50%" bgcolor="#808080"><font size="2"><b>号码</b></font></td>
<td align=center width="20%" bgcolor="#808080"><font size="2"><b>是否删除</b></font></td>
</tr>
<tr>
<td width=20 bgcolor=#909090>
<span id="lt"></span>
</td>
<td bgcolor=#909090>
<span id="dt"></span>
</td>
</tr>
</table>
</form>
</body>
</html>
<head>
<script language=javascript>
function window.onunload(){
form.alltext.setAttribute("data",form.alltext.value);
form.alltext.save("cache");
}
function window.onload(){
form.alltext.load("cache");
if(form.alltext.getAttribute("data"));
form.alltext.value=form.alltext.getAttribute("data");
var num = document.getElementById("alltext").value.split('|').length-1;
for(i=0;i<num;i++)
{
document.getElementById("lt").innerHTML += document.getElementById("alltext").value.split('|')[i]+"<p>";
document.getElementById("dt").innerHTML += "<a href='javascript:deleterow("+ i +")'>删除</a>"+"<p>";
}
}
</script>
<script type=text/javascript>
function inPutOpen(){
var str = document.getElementById('qwe').disabled;
str==true?(document.getElementById('qwe').disabled=false):(document.getElementById('qwe').disabled=true);
}
function check(){
var str = document.getElementById('qwe').value;
var num = str.length;
var reg=new RegExp("^[A-Fa-f0-9]+$");
if( !reg.test( str ) ){
alert("对不起,你输入的范围必须是0-9|a-f|A-F");
return;}
if(num!=20){
alert("您的输入不满足20个字符的要求,请重新输入!");
document.getElementById('qwe').value='';
}else{
alert("输入成功,您输入的字符为:"+document.getElementById('qwe').value);
document.getElementById("alltext").value += document.getElementById('qwe').value+"|";
}
}
function deleterow(i){
var num = document.getElementById("alltext").value.split('|').length-1;
var arr = document.getElementById("alltext").value.split('|');
var tpstr = document.getElementById("alltext").value;
document.getElementById("alltext").value="";
for(j=0;j<num;j++)
{
if(j!=i)
document.getElementById("alltext").value += arr[j]+"|";
}
alert("删了");
window.location.reload();
}
</script>
</head>
<body>
<form method=post id=getElementByID>
<table width=450 class=body>
<tr><p><font size=2><b>
<input type="checkbox" id="tim" value="ON" onclick=inPutOpen()>开启</b></p><tr>
<tr><td><font size=2><b>号码:</b><input type="text" id="qwe" disabled>请输入数字或字母[a-f|A-F],必须输入20个字符!
</tr></td>
<p><input type="submit" value="提交" id="tijiao" size="12" onclick="check()" ></p>
</table>
</form>
<form action= method=POST id="formFilterDel" name="form">
<input type="text" id="alltext" readonly="true" style="VISIBILITY: hidden;behavior:url(#default#userdata)">
<table width=513>
<tr><td width=507 class=titleCell><b>当前MAC地址过滤表:</b></tr>
</table>
<table border="0" width=500>
<tr>
<td align=center width="50%" bgcolor="#808080"><font size="2"><b>号码</b></font></td>
<td align=center width="20%" bgcolor="#808080"><font size="2"><b>是否删除</b></font></td>
</tr>
<tr>
<td width=20 bgcolor=#909090>
<span id="lt"></span>
</td>
<td bgcolor=#909090>
<span id="dt"></span>
</td>
</tr>
</table>
</form>
</body>
</html>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你时问我们什么啊?
具体点,你就说了你代码的功能,也不知道是你现在的代码有错还是要干什么?
具体点,你就说了你代码的功能,也不知道是你现在的代码有错还是要干什么?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
分太少了 要是多给点我可以给你做一个
用javascript和dom实现
用javascript和dom实现
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
数据存到哪里 数据库 XML 还是cookie?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询