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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -