I am not so into JavaScript and I have the following problem.
Into a JSP page I have the following "link":
<tr onmouseout="Javascript: this.style.background='#FFFFFF';
this.style.color='#003399';"
onmouseover="Javascript: this.style.background='#003399';
this.style.color='#FFFFFF'; this.style.cursor='hand';"
onclick="changeLocationTo('edi.do?serv=4.U');">
<td style="border-top: 0px;">
Tabella Anagrafica
</td>
</tr>
So, when the user click on the tr element it is performed the changeLocationTo()
JavaScript function passing to it the String 'edi.do?serv=4.U'
.
Into this page I have defined the script section:
<script language="JavaScript" src="js/Script.js">
function changeLocationTo(newLocation) {
alert("INTO changeLocationTo, nweLocation: " + newLocation);
loadingPopUp();
// you may add an timeout here or to handle a popup action like closing it
document.location.href = newLocation;
}
</script>
My problem is that when I click on the previous tr link it don't perform the changeLocationTo()
function and into the FireBug console is is shown this error message every time that I click on the tr :
ReferenceError: changeLocationTo is not defined
Why? what could be the problem? How can I try to fix it? What am I missing?
您的script
元素有一个src
属性,因此其中的代码将被忽略,而是加载来自 URL 的脚本。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.