I have two different script tags,can i call function from second..like this
<script>
var = something;
. . .
<td onclick="myFunc("+something+")"></td>
</script>
<script>
function myFunc(data){..}
</script>
I have two different script tags,can i call function from second..like this
<script>
var = something;
. . .
<td onclick="myFunc("+something+")"></td>
</script>
<script>
function myFunc(data){..}
</script>
Move your <td>
tag out of <script>
tag down after second <script>
and you will be able to.
Btw, consider changing blockquotes in <td onclick="myFunc("+something+")"></td>
to quotes like this <td onclick="myFunc('+something+')"></td>
, other way your HTML will not be parsed correctly
Yes, you can. The functions are at the global level. Here is an example:
<script type="text/javascript">
function hi() {
alert('hi');
}
</script>
<script type="text/javascript">
hi();
</script>
This does indeed result in a popup with "hi".
JSFiddle: http://jsfiddle.net/we8pb7md/