I want to call the javascript function of one web page from another web page. Suppose I have a function myFunction()
that is defined in A.html
and I want to use it in B.html
using onclick
attribute. How would I call myFunction()
using onclick
in B.html
, so that it could bring some change in A.html
?
Here is the example...
A.html
includes
<script>
function myFunction() {
document.getElementById("my_contents").style.display="block";
}
</script>
where B.html
have
<a href="Contents.html#entertainment" target="ccc" onclick="myFunction()">
<h4>Entertainment</h4></a>