0
<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>";
1
  • http://www.unm.edu/~jka/courses/images/icon_tree1.gif is not a JavaScript string literal. Try again. (Hint: compare x with 'x') Commented Apr 19, 2013 at 20:16

2 Answers 2

2

URL address is a string, so you should surround it with quotes:

... onclick="openWindow(2,1,4326,'http://www.../images/icon_tree1.gif');" ...
Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.