Hello all. I am trying to get a function call from an onclick used in a html form
it looks like this.
function work(strVal) {
alert(strVal);
return 1;
}
and this
<a href='#' onclick='work('word')'><img src='$RestaurantName' style='border-style: none' height='300' width='300' onMouseOver='mouseOver1()' onMouseOut='mouseOut1()'></a>
I don't know javascript very well but i do know java, and this should work with a string. When i use the work() function in a onclick it only works with an integer. If i use it anywhere else i can use and integer or string.
so if i do this it will cause a pop up alert that shows the integer correctly
<a href='#' onclick='work(0)'><img src='$RestaurantName' style='border-style: none' height='300' width='300' onMouseOver='mouseOver1()' onMouseOut='mouseOut1()'></a>
If i do this it will not pop up 'word'
<a href='#' onclick='work('word')'><img src='$RestaurantName' style='border-style: none' height='300' width='300' onMouseOver='mouseOver1()' onMouseOut='mouseOut1()'></a>
Is there something about an onclick that limits the use of a string in the functions arguement. this function works with a string if i call it from somewhere else, it just doesnt work in onclick . I have not clue thanks alot people.