bhakti123 bhakti123 - 1 year ago 46
CSS Question

How to open a local html file from html page?

I am trying to open a local html file from a running html file.In simple words, when I click on a button in my html page it should open another html page which is stored on my computer only. I have tried using

but it is not working.I am using
so when i click on the button it opens a new window but the html is not loaded on the page.I can only use html or Java Script.

Here is what I am doing

<script lang="Java-Script">
function func()
var m='<a href="newone.html" target="-blank"></a>';
<input type="Submit" value="click" onclick="func()">

Kos Kos
Answer Source
  1. Forget about document.write. If you wanted to add a link element to a web page (not needed here), you could try using document.createElement and document.body.appendChild.
  2. If you want to navigate to an URL through Javascript, you can assign to window.location.
  3. Instead of a button, maybe you can make a normal link in the first place?