Trying to use a form box with HTML to create a url that can be used to change an IFRAME. This is what I currently have.
<input type="url" id="URL" value="">
<button onclick="webFunct()">Go!</button>
<br><a href= id="ViewURL" target="WebViewer></p>
<script>
function webFunct() {
var x = document.getElementById("URL").value;
document.getElementById("ViewURL").innerHTML = x;
}
</script>
<iframe width="100%" height="640px" name="WebViewer">
</iframe>
I like the form box to change the IFRAME to the website that was entered by the user to visit. I know this information is minimal and possibly vague but I normally don't ask for help and I don't know what else to ask.
Original code from: http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_url_get
You can set URL of iframe
programmatically:
document.getElementById('web-view').src = url;
Check this out: http://jsfiddle.net/andunai/d1zavddu/
However, please note that many websites, e.g. google.com
and yahoo.com
do not permit getting themselves inserted into iframe
s.
<input type="url" id="URL" value="">
<button onclick="webFunct()">Go!</button>
<script>
function webFunct() {
document.getElementById("frame").src = x;
}
</script>
<iframe width="100%" id="frame" height="640px" name="WebViewer">
</iframe>
Dont forget to change "x" to an url