...

View Full Version : Change address link within object/ iFrame using form/ simple embedded browser



Taro
06-19-2012, 01:25 AM
Hello,

I have some trouble trying to create a JavaScript browser, having the source of the object/ iFrame be changed using a normal html form without a prompt (so exclude the document.getElementById('theframe').src = prompt("Type in URL",""); and use something like <textarea rows="" cols="" name="textarea1"></textarea> instead). So I was trying to find something other than window.open or anything that replaces the entire page of the content, but still shows the form.



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Testing</title>

<script type="text/javascript">
parent.document.getElementById('theframe').src = "http://www.google.com";
document.getElementById('theframe').src = prompt("Type in URL","");
</script>
</head>
<body>
<iframe id="theframe" name="theframe" src="http://www.google.com" width="400" height="400">
</body>
</html>

I've tried and experimented with different types of ways, using the window. formula, but could not figure it out. In addition, I think the parent object is not working; I tried to make a default link for that as well.

EpicWebDesign
06-19-2012, 05:04 AM
Not quite sure what you are asking. Do you want the result of what they type in the textarea to be displayed on the page beneath (or above) the form? Or are you tyring to create links based on user input in that textarea?

Either way, have you tried using the simple "innerHTML" function and assigning it to a span within your page?

I've I've missed your point, please let me know and I'll try to provide a different solution based on your updated info.

Taro
06-19-2012, 09:36 PM
Not quite sure what you are asking. Do you want the result of what they type in the textarea to be displayed on the page beneath (or above) the form? Or are you tyring to create links based on user input in that textarea?

Either way, have you tried using the simple "innerHTML" function and assigning it to a span within your page?

I've I've missed your point, please let me know and I'll try to provide a different solution based on your updated info.

I am trying to create what would be a mini-browser using a form. Whatever the user types into the text area will be what is displayed only within the object. In the attached image is an example of close to what it probably looks like.

As you can see, after the user types a certain URL and submits it, the website displays in the object (in this example I did not use an iFrame). In other words, if I type "http://google.com" in the URL text area and submit it, then the Google site will show in the object.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum