Reputation: 2502
<a href="javascript:void();" onclick="openWindow(2,1,4326,http://www.../images/icon_tree1.gif);">Edit Asset Info</a>
Function openWindow is not called and I am see the folowing error on console
Uncaught SyntaxError: Unexpected token :
and
Uncaught SyntaxError: Unexpected token )
This is the actual code I am using
return "<a href='javascript:void();' onclick='openWindow(" 2 "," + 1 + "," + 4326 + "," + symbolurl + ");'>Edit Asset Info</a>";
Upvotes: 0
Views: 136
Reputation: 2029
You need to pass a string to the onclick handler onclick="openWindow(1, 2, 3, 'http://...')"
Some other comments:
1, If your anchor doesn't actually take the user anywhere, consider not to use <a>
rather than href="javascript:void();"
2, try not to mix javascript with html. so link your event handler to the DOM element in a <script>
tag.
Upvotes: 0
Reputation: 145368
URL address is a string, so you should surround it with quotes:
... onclick="openWindow(2,1,4326,'http://www.../images/icon_tree1.gif');" ...
Upvotes: 2