NickyTheWrench NickyTheWrench - 1 year ago 69
HTML Question

Inserting a javascript variable into onclick

I'm trying to insert a JavaScript variable into an href, and make it open in a new window.

Here is my code:

<a href="" onclick="'?VALUE='+testVALUE;, '_blank'); return false;">Click Here</a>

var testVALUE = '1AB56';

The URL should look like this:

Can someone please tell me where I'm going wrong?
Thanks for your help!

Answer Source

There's a ; in the middle of the argument you pass to Just after testVALUE

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download