Pass array in HTML method parameters javascript -


i know easy one, can't find looking for. wondering if possible pass array method parameter, through html. if possible think this:

<img src="img.png" alt="picture" onclick="thismethod1(['facebook','twitter'])"/> 

the javascript this:

function thismethod1(socialarray) {      //use array } 

is correct?
the reason asking because there error in code , trying find it.

yes should work, demonstrates:

<script> function thismethod1(socialarray) {     alert(socialarray); } </script>  <img src="img.png" alt="picture" onclick="thismethod1(['facebook','twitter'])"/> 

if image inside link, clicking might cause link submit, may causing think there's error in code.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

c++ - End of file on pipe magic during open -