Javascript:
function clickedLink(l){
alert(l);
}
PHP:
If I don't pass in a parameter, like this. It returns undefined, which is correct.
echo '<tr class='.$class.' onclick="clickedLink();">;
If I try to pass a parameter in nothing happens.
echo '<tr class='.$class.' onclick="clickedLink("test");">';
echo '<tr class='.$class.' onclick="clickedLink(\"test\");">';
echo '<tr class='.$class.' onclick="clickedLink('.$test.');">';
Any idea on why it's not working? It might be me not understanding how to access Javascript parameters inside the function.
Try adding \\' like this
clickedLink(\\'.$test.\\')
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.