[Javascript] calling functions with parameters
Tim Burgan
email at timburgan.com
Sat Jul 23 07:05:38 CDT 2005
Hello,
I'm trying to call a function that has parameters, but nothing happens.
IE tells me that my function call has an error.
I've never "learned" javascript.. I'm just trying to play with it myself
by applying my knowledge of PHP and Java. Am I able to use parameters is
this way?
The error message in IE is:
Not implemented
The code for my function call is (this is the code where the error occurs):
window.onload = showHideOption("a","popup");
The function is:
function showHideOption(tag, cssClass)
{
/* Ensure the DOM is available */
if ( !document.getElementsByTagName )
return false;
/* Get all links */
var links = document.getElementsByTagName("a");
/* Find an anchor that has been clicked */
for ( var i = 0; i < links.length; i++ )
{
if ( links[i].className.match(cssClass) )
{
links[i].onclick = function()
{
this.style.color = 'red';
return false;
}
}
}
}
Thanks
Tim
More information about the Javascript
mailing list