Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] calling functions with parameters
- From: email at timburgan.com (Tim Burgan)
- Subject: [Javascript] calling functions with parameters
- Date: Sat Jul 23 07:06:39 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
- Follow-Ups:
- [Javascript] calling functions with parameters
- From: Matt Warden
- [Javascript] calling functions with parameters
- Prev by Date: [Javascript] onclick - unobtrusive javascript
- Next by Date: [Javascript] JavaScript books
- Previous by thread: [Javascript] onclick - unobtrusive javascript
- Next by thread: [Javascript] calling functions with parameters
- Index(es):