I have two html pages first one is index.html and another one is content.html. content.html page contains a JavaScript function and i would like to call that function from index.html page.
I have embedded the content.html page into index.html page. So please suggest me how can i call that function. Here is the code of both pages. Index.html
<div id="content" class="bg-danger">
<embed src="content.html" id="child" width="100%" height="100%" style="height: 100%">
</embed>
</div>
Content.html
<body>
<script type="text/javascript">
function content2(){
alert("content");
}
</script>
<div>
Content Page
<button id="contentbtn" onclick="content();">Click</button>
</div>
Making a external file makes its easy but condition is that the code must reside on javascript html page.