当前位置:Gxlcms > PHP教程 > PHP网页添加JS代码有关问题

PHP网页添加JS代码有关问题

时间:2021-07-01 10:21:17 帮助过:5人阅读

PHP网页添加JS代码问题
我在JS文件下建了一个文件"member_message_detail.js",代码如下.但在其它文件加载此文件却无法执行"",请帮忙大哥!

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;
};
};
}

人气教程排行