PDA

View Full Version : Load HTML file



soheil
06-29-2012, 03:42 PM
I want to load a html file with click event...(given html file should be loaded with clicking on special button)
how can i do that with javscript? any solution?
thanks in advance

Philip M
06-29-2012, 07:13 PM
I want to load a html file with click event...(given html file should be loaded with clicking on special button)
how can i do that with javscript? any solution?
thanks in advance

Use an <iframe>


<div id = "container" style="display:none">
<iframe id = "frame1" src = "" width="100%" height="300"></iframe>
</div>

<input type ="button" value = "Load HTML page" onclick = "showIt()">

<script type = "text/javascript">
function showIt() {
document.getElementById("container").style.display="block";
document.getElementById("frame1").src = 'http://www.javascriptkit.com'
}

</script>or Ajax ...

or jQuery ...

All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.