错误:zygh is not defined at HTMLAnchorElement.onclick
原因:function 方法写在 $(function(){}) 中、$(function(){}) 相当于匿名方法、里面是私有变量、所以页面找不到这个 function
语句:<input type="button" value="转移" οnclick="zygh();"/>
解决办法(两种解决方式):
1.定义在 $(function(){}) 外,这样可以调用成功
function zygh(){
alert("1");
}
$(function(){
alert("0");
})
2.定义 var 接收
var zygh = "";
$(function(){
zygh = function (){
alert("我是zygh");
}
})