Home  >  Article  >  Backend Development  >  PHP网页添加JS代码有关问题

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

WBOY
WBOYOriginal
2016-06-13 12:25:511175browse

PHP网页添加JS代码问题
我在JS文件下建了一个文件"member_message_detail.js",代码如下.但在其它文件加载此文件却无法执行"<script></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;
};


};
};
------解决思路----------------------

getElementBy<span style="color: #FF0000;">I</span>d

getElementById
不是
getElementByld
------解决思路----------------------
改成这样就可以了,你直接覆盖使用吧。
<br />window.onload=function(){<br />	var ret=document.getElementById('return');<br />	var del=document.getElementById('delete');<br />	ret.onclick=function(){<br />		history.back();<br />	};<br />	del.onclick=function(){<br />		if(confirm('你确定要删除此短信!')){<br />		  location.href='member_message_detail.php?action=delete&id='+this.name;<br />		};<br />	};<br />}<br />

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn