snowweb
09-26-2005, 09:49 AM
Hi Guys,
I have a problem on www.tludatasystems.com.ph (http://www.tludatasystems.com.ph).
I'm using a row of table cells as buttons and changing the button class onmouseover to create rollover effect. It works fine on IE6 but not in IE5 or in Firefox.
Fortunately, Firefox gives me the following hint as to the problem:
Error: event is not defined
Source File: http://www.tludatasystems.com.ph/
Line: 25
Here is a copy of the code:
<SCRIPT LANGUAGE="JavaScript" ID=code>
function testToggle() {
// Walk elements to see if user clicked in toggle button
var el = event.srcElement
while ((el.getAttribute("swap")==null) && (el.tagName!="BODY"))
el = el.parentElement
return el
}
function doSwapIt() {
var el = testToggle()
if (el.getAttribute("swap")!=null) {
// Check if contents need to be swapped
if (el.getAttribute("swap")!="") {
var temp = el.innerHTML;
el.innerHTML = el.getAttribute("swap")
el.setAttribute("swap", temp, false)
}
// Swap the style
el.className = (el.className=="over") ? "notover" : "over"
}
}
// Hook up event handlers
document.onmouseover = doSwapIt
document.onmouseout = doSwapIt
document.onclick = doSwapIt
</SCRIPT>
The symptom of the problem is that the table cells which are supposed to display as links are no longer links & there is no rollover effect :eek:
Can anyone spot the error in my code and help me fix it please as I'm useless at javascript!!
I appreciate all your help. Thanks.
Kindest regards
peter
I have a problem on www.tludatasystems.com.ph (http://www.tludatasystems.com.ph).
I'm using a row of table cells as buttons and changing the button class onmouseover to create rollover effect. It works fine on IE6 but not in IE5 or in Firefox.
Fortunately, Firefox gives me the following hint as to the problem:
Error: event is not defined
Source File: http://www.tludatasystems.com.ph/
Line: 25
Here is a copy of the code:
<SCRIPT LANGUAGE="JavaScript" ID=code>
function testToggle() {
// Walk elements to see if user clicked in toggle button
var el = event.srcElement
while ((el.getAttribute("swap")==null) && (el.tagName!="BODY"))
el = el.parentElement
return el
}
function doSwapIt() {
var el = testToggle()
if (el.getAttribute("swap")!=null) {
// Check if contents need to be swapped
if (el.getAttribute("swap")!="") {
var temp = el.innerHTML;
el.innerHTML = el.getAttribute("swap")
el.setAttribute("swap", temp, false)
}
// Swap the style
el.className = (el.className=="over") ? "notover" : "over"
}
}
// Hook up event handlers
document.onmouseover = doSwapIt
document.onmouseout = doSwapIt
document.onclick = doSwapIt
</SCRIPT>
The symptom of the problem is that the table cells which are supposed to display as links are no longer links & there is no rollover effect :eek:
Can anyone spot the error in my code and help me fix it please as I'm useless at javascript!!
I appreciate all your help. Thanks.
Kindest regards
peter