我在JS文件下建了一个文件"member_message_detail.js",代码如下.但在其它文件加载此文件却无法执行"<script type="text/javascript" src="js/member_message_detail.js"></script>",请帮忙大哥!
window.onload=function(){
var ret=document.getElementByld('return');
var del=document.getElementByld('delete');
ret.onclick=function(){
history.back();
};
del.onclick=function(){
if(confirm('你确定要删除此短信!')){
location.href='member_message_detail.php?action=delete&id='+this.name;
};
};
};
------解决思路----------------------
getElementById
getElementById
不是
getElementByld
------解决思路----------------------
改成这样就可以了,你直接覆盖使用吧。
window.onload=function(){
var ret=document.getElementById('return');
var del=document.getElementById('delete');
ret.onclick=function(){
history.back();
};
del.onclick=function(){
if(confirm('你确定要删除此短信!')){
location.href='member_message_detail.php?action=delete&id='+this.name;
};
};
}