javascript - jasvascript call functions from different scripts -


i have 2 different script tags,can call function second..like this

<script> var = something; . . . <td onclick="myfunc("+something+")"></td> </script>   <script>   function myfunc(data){..} </script> 

yes, can. functions @ global level. here example:

<script type="text/javascript">     function hi() {       alert('hi');     } </script>  <script type="text/javascript"> hi(); </script> 

this indeed result in popup "hi".

jsfiddle: http://jsfiddle.net/we8pb7md/


Comments

Popular posts from this blog

symfony - TEST environment only: The database schema is not in sync with the current mapping file -

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -