Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call javascript file in html

I am trying to call innerHtml in JavaScript its working in the same file but not in the separate JavaScript JS file. my working code is

<script type="text/javascript">
   function my()
    document.getElementById("abc").innerHTML="hello";
    } 
    </script>
<div id="abc" onmouseover ="my()"> hi hw ru  </div>

But if I invoke this method in separate JavaScript file its not working even I am giving the source path of the JavaScript file like

<script type="text/javascript" src="js/framemrq.js">
like image 578
Adesh singh Avatar asked Jul 03 '26 11:07

Adesh singh


1 Answers

Missing the function keyword

<script type="text/javascript">
  function my(){

        // Your code here
   }
</script>
like image 146
Sushanth -- Avatar answered Jul 05 '26 00:07

Sushanth --



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!