我点击这个退订button没有任何反应。
用chrome developers tools看到的代码如下:
不太熟JS代码,想请教一下问题出在哪儿呢?
补充:console里的错误信息:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>邮件退订</title>
<script type="text/javascript" src="//assets.daily.taobao.net/apps/ims/js/jquery/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="//assets.daily.taobao.net/apps/ims/js/jquery/jquery.taobao.util.js"></script>
<script type="text/javascript" src="//assets.daily.taobao.net/apps/ims/js/lhgdialog/lhgcore.min.js"></script>
<script type="text/javascript" src="//assets.daily.taobao.net/apps/ims/js/lhgdialog/lhgdialog.min.js"></script>
<link rel="stylesheet" type="text/css" href="//assets.daily.taobao.net/apps/ims/js/My97DatePicker/skin/WdatePicker.css"/>
<script type="text/javascript" src="http://www.my97.net/dp/My97DatePicker/WdatePicker.js"></script>
</head>
<body><script>
with(document)with(body)with(insertBefore(createElement("script"),firstChild))setAttribute("exparams","category=&userid=&aplus&yunid=&asid=AAAJoXNW58izHkRs3X0=",id="tb-beacon-aplus",src=(location>"https"?"//s":"//a")+".tbcdn.cn/s/aplus_v2.js")
</script>
<style type="text/css">
table{
border-collapse:collapse;
font-size:14px;
}
.title{
color:white;
font-weight:bold;
font-size:20px;
}
.txtInput{
position:relative;
left:35px;
}
.hint{
color:grey;
}
.button{
width: 100px;
line-height: 30px;
text-align: center;
font-weight: bold;
color: #fff;
text-shadow:1px 1px 1px #333;
border-radius: 5px;
margin:0 20px 20px 0;
position: relative;
overflow: hidden;
font-size:15px;
cursor:pointer;
}
.button.yellow{
border:1px solid orange;
box-shadow: 0 1px 2px orange inset,0 -1px 0 orange inset,0 -2px 3px orange inset;
background: -webkit-linear-gradient(top,orange,orange);
background: -moz-linear-gradient(top,orange,orange);
background: linear-gradient(top,orange,orange);
}
</style>
<center>
<input type="hidden" id="mailAddress" value="WolgP025DLe8NPK9yR6RabhRMpzRnH5c" />
<table width="680px" border="1">
<tr>
<td height="40" colspan="2" bgcolor="orange" align="center">
<span class="title">邮件退订</span>
</td>
</tr>
<tr>
<td width="150" height="380">
<div align="center" valign="center">您的退订原因</div>
</td>
<td>
<span class="txtInput">
<input type="radio" name="unreason" value="1">邮件过多<br><br>
</span>
<span class="txtInput">
<input type="radio" name="unreason" value="2">不感兴趣<br><br>
</span>
<span class="txtInput">
<input type="radio" name="unreason" value="3">其他原因<br><br>
</span>
<span class="txtInput">
<textarea cols="30" id="reasonWhy" rows="5" name="reasonWhy" style="overflow:hidden;resize:none" ></textarea><br><br>
</span>
<span class="txtInput">
<input type="button" id="btnSubmit" class="button yellow" value="确认退订"/> <br />
<span id="spanHint" style="color:red;font-weight:bold"></span>
</span>
</td>
</tr>
</table>
<table width="600px" border="0">
<tr>
<td height="80" colspan="2">
<div align="center" class="hint">感谢您对阿里产品的使用,恳请您留下宝贵意见以便我们能为您提供更好的服务</div>
</td>
</tr>
</table>
</center>
<script type="text/javascript">
$(function(){
// 邮件地址
var url = "http://mcmailunsubscribe.alibaba-inc.com/mcmailunsubscribe/unsub/emailunsubscribeinfo.htm?msg=";
// 信息显示
var spanHint = $('#spanHint');
// 点击事件
$("#btnSubmit").click(function(){
var unreason = $('input[name=unreason]:checked').val();
var mailAddress = $('#mailAddress').val();
var reasonWhy = $("#reasonWhy").val();
if(!unreason){
spanHint.html("请选择您的退订原因");
return;
}
if(!mailAddress){
spanHint.html("您的邮箱地址为空");
return;
}
if(reasonWhy && getRealLength(reasonWhy) > 400){
spanHint.html("您填写的原因长度超出范围");
return;
}
if(!confirm("您确认进行退订操作吗?")){
return false;
}
spanHint.html("");
var param = {};
param["unreason"] = unreason;
param["reasonWhy"] = reasonWhy;
param["mailAddress"] = mailAddress;
buttonDis();
spanHint.html("提交中请稍候...");
jQuery.ajax({
type:'post',
url:'http://mcmailunsubscribe.alibaba-inc.com/mcmailunsubscribe/MailSubmissionAction.do',
data:param,
dataType:'json',
contentType:"application/x-www-form-urlencoded;charset=UTF-8",
success:function(data) {
var msg = "";
if(data && data.code){
if("success" == data.code){
msg = "退订操作成功";
}
else if ("error" == data.code){
msg = "退订操作失败,请您确认邮箱信息或者联系客服";
}
spanHint.html(msg);
buttonDis();
location.replace(url + msg);
}
else if(data && data.result){
spanHint.html(data.result);
buttonEnable();
}
}
});
});
function getRealLength(str) {
var realLength = 0;
var len = str.length;
var charCode = -1;
for (var i = 0; i < len; i++) {
charCode = str.charCodeAt(i);
if (charCode >= 0 && charCode <= 128){
realLength += 1;
}
else realLength += 2;
}
return realLength;
}
function buttonDis(){
$("#btnSubmit").attr("disabled","disabled").css("display","none");
}
function buttonEnable(){
$("#btnSubmit").attr("disabled",null).css("display","block");
}
});
</script>
</body>
</html>
第2行错误不是告诉你错误了吗,jquery没有成功加载啊~~~
jquery没加载进来,原因是