1 Star 0 Fork 0

rofound / Rofound.github.io

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
mysql_data.html 5.29 KB
AI 代码解读
一键复制 编辑 原始数据 按行查看 历史
刘培 提交于 2018-01-19 00:45 . Update mysql_data.html
<!doctype html>
<html lang="en">
<!-- Kevin_Liu -->
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>mysql 添数据助手1.2版</title>
<script type="text/javascript">
String.prototype.startsWith=function(str){
var reg=new RegExp("^"+str);
return reg.test(this);
}
//测试ok,直接使用str.endWith("abc")方式调用即可
String.prototype.endsWith=function(str){
var reg=new RegExp(str+"$");
return reg.test(this);
}
/*
使用方法:
将以下类型的数据放在文本框中,然后点击 OK 即可
1 博尔特 男 牙买加,
2 苏炳添 男 中国,
3 伊辛巴耶娃 女 俄罗斯,
4 范尼凯克 男 南非,
5 刘翔 男 中国,
6 罗伯斯 男 古巴,
7 苏尔 女 美国,
8 盖伊 男 美国,
9 加特林 男 美国,
10 张培萌 男 中国,
11 席尔瓦 女 巴西
*/
var flag = false;
var btn_ok;
var t_name;
var result;
function prints(s){
var reg=new RegExp("^"+"insert into "+document.getElementById('t_name').value + " values");
//alert(reg.test(document.getElementById('t_print').value));
if(reg.test(document.getElementById('t_print').value)){
return false;
}else{
s = " " + s ;
ss=s.split(/[,]/);
var result = "";
for(var i=0;i<ss.length;i++){
var str = ss[i];
var arr = str.split(/\s+/);
//document.write("(");
result += "(";
for(var j=1;j<arr.length;j++){
//document.write("'"+arr[j]+"'");
result += "'"+arr[j]+"'";
if(j!=arr.length-1)
//document.write(",");
result += ",";
}
if(i==ss.length-1)
//document.write(");<br/>");
result += ");";
else
//document.write("),<br/>");
result += "),\n";
}
return result;
}
}
/* print(` 1 博尔特 男 牙买加,
2 苏炳添 男 中国,
3 伊辛巴耶娃 女 俄罗斯,
4 范尼凯克 男 南非,
5 刘翔 男 中国,
6 罗伯斯 男 古巴,
7 苏尔 女 美国,
8 盖伊 男 美国,
9 加特林 男 美国,
10 张培萌 男 中国,
11 席尔瓦 女 巴西`);
print(` 1 101 7,
1 103 4,
1 104 2,
1 105 4,
2 101 2,
3 106 7,
8 101 0,
8 103 2,
9 101 4,
4 103 7,
4 105 7,
5 104 7,
6 104 4,
7 106 2,
10 101 0,
11 106 4`);
print(` 101 男子100M 诺坎普,
103 男子200M 温布利,
104 男子110M栏 鸟巢,
105 男子400M 卢日尼基,
106 女子撑杆跳 温布利`);
print(` 2005-05-09 胜,
2005-05-09 胜,
2005-05-09 负,
2005-05-09 负,
2005-05-10 胜,
2005-05-10 负,
2005-05-10 负`);*/
function fun_p(){
flag = true;
if(flag){
btn_ok = document.getElementById('btn_ok');
btn_ok.disabled = true;
}
if(prints(document.getElementById('t_print').value) != false){
t_name = document.getElementById('t_name').value;
result = document.getElementById('t_print').value = "insert into " + t_name + " values" + prints(document.getElementById('t_print').value);;
}
}
function fun_change(){
var reg=new RegExp("^"+"insert into "+document.getElementById('t_name').value + "\s+$");
if(result != document.getElementById('t_print').value||!reg.test(document.getElementById('t_print').value)){
var btn_ok = document.getElementById('btn_ok');
btn_ok.disabled = false;
}
setTimeout("fun_change()",10);
}
</script>
</head>
<body onload="fun_change()">
<form>
表名:
<input type="text" id="t_name" style=""/>
<hr />
<textArea id="t_print" name='' style="height:300px;width:1024px;" onchange="fun_change()"></textArea>
<br />
<input type="button" id="btn_ok" style="height:50px;width:600px;" value="OK" onclick="fun_p();"/>
<input type="reset" style="height:50px;width:427px;" />
<div>
<pre>
PS:使用方法:
将以下类型的数据放在文本框中,然后点击 OK 即可
1 博尔特 男 牙买加,
2 苏炳添 男 中国,
3 伊辛巴耶娃 女 俄罗斯,
4 范尼凯克 男 南非,
5 刘翔 男 中国,
6 罗伯斯 男 古巴,
7 苏尔 女 美国,
8 盖伊 男 美国,
9 加特林 男 美国,
10 张培萌 男 中国,
11 席尔瓦 女 巴西
</pre>
</div>
</form>
</body>
</html>
HTML
1
https://gitee.com/giteerofound/Rofound.github.io.git
git@gitee.com:giteerofound/Rofound.github.io.git
giteerofound
Rofound.github.io
Rofound.github.io
master

搜索帮助