forked from mayining043/Yue_WebApp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubrun.html
158 lines (131 loc) · 5.69 KB
/
subrun.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,user-scalable=no">
<link rel="stylesheet" type="text/css" href="css/total.css">
<link rel="stylesheet" type="text/css" href="css/sm.css">
<title>约约约</title>
</head>
<body>
<div id="bg" style="width:360px;height:480px;background-image: url(images/002.gif);background-size: cover" >
</div>
<div class="smpart" id="fp">
<label>
跑步<input id="rantname" type="text" maxlength="25" placeholder="请填写约跑地点">
</label>
</div>
<div class="smpart">
<label>
时间<input id="time" type="text" maxlength="20" placeholder="请填写约跑时间">
</label>
</div>
<div class="smpart">
<label>
人数<input id="amount" type="text" maxlength="10" placeholder="请填写约跑人数">
</label>
</div>
<div class="smpart">
<label>
可见<select id="isshow" style="color: rgb(153,153,153); width: 155px;" onchange="choose(this)">
<option value="">请选择</option>
<option value="汉纸">汉子可见</option>
<option value="妹子">妹纸可见</option>
<option value="任何人可见">任何人可见</option>
</select>
</label>
</div>
<div class="smpart">
备注<textarea id="intro" maxlength="100" placeholder="可选填" value=""></textarea>
</div>
<div class="smbtn">
<button id="btn" onclick="submit()">确认发布</button>
</div>
</body>
<script src="jquery-3.1.0.min.js"></script>
<script type="text/javascript">
$.get("online.php",
function(data,status){
if (status=="success"){
if(data!=0){
var r=confirm("请先登录!");
if (r==true)
{
window.location.href="index.html";
}
else
{
alert("再见!");
}
}
}
});
var w=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;
if(w<=414){
document.getElementsByTagName('body')[0].style.width= w+'px';
document.getElementById('bg').style.width=w+'px';
document.getElementById('bg').style.height=w*480/360+'px';
}
function submit(){
var kind="约跑";
var username="见鬼了";
var rantname=document.getElementById('rantname').value;
var time=document.getElementById('time').value;
var amount=document.getElementById('amount').value;
var isshow=document.getElementById('isshow').value;
var intro=document.getElementById('intro').value;
if(rantname==""){
alert("小Y不知道你的约跑地点耶!");
}
else if(time==""){
alert("小Y不知道你的约跑时间耶!");
}
else if(amount==""){
alert("小Y不知道你的约多少个人耶!");
}
else if(isshow==""){
alert("小Y不知道你想约汉子还是妹子耶!");
}
else{
$.post("add.php",
{
kind: kind,
username: username,
rantname: rantname,
time: time,
amount: amount,
isshow: isshow,
intro: intro
},
function(data,status) {
if (status=="success"){
var condition = data;
switch (condition)
{
case "0": alert("约跑信息已经成功发布~\(≧▽≦)/~");window.location.href="showrun.html";break;
case "1": alert("数据连接失败QUQ");break;
case "2": alert("录入信息失败QUQ");break;
default:alert(condition);break;
// "未知错误"
}
}
else{
alert("Request was unsuccessful: " + status);
}
}
);
document.getElementById("btn").style.backgroundColor="#635D53";
document.getElementById("btn").disabled=true;
document.getElementById("btn").innerHTML="已提交";
}
}
function choose(t){
if(t.value!=""){
t.style.color="black";
}
else{
t.style.color="rgb(153,153,153)";
}
}
</script>
</html>