Log in

View Full Version : controling iframe address Help Please.



leomoon
11-17-2007, 04:44 AM
Hi, I have a little problem.
I want to make a little web app that will do this:
There will be a text field on top, beside it "Go", "Refresh", "Back" "Forward" buttons. After those there will be an iframe that will open www.google.com for example. Now I want to do this. I want to be able to type an address in that text field and when I hit "Go" button, it changes the address of the iframe. And other functions for other buttons to control the iframe. I searched lots of websites and I couldn't find anything useful.

If anyone knows or knows an example of this on the internet, please help me.

Tnx. Waiting for your reply. :)

Hyperactive
11-17-2007, 11:46 AM
You must use php, you cant do that with html only. Simple example that i made:


<html>

<head>

<title>Iframe testing</title>

</head>

<body>


<form action="#" target="window">
<input type=button value="Back" onClick="javascript:history.go(-1)">

<input type=button value="Refresh" onClick="history.go()">

<input type = "button" value = "Forward" onClick = "window.history.go(1)">

</form>

<form action="#" method="get">

<input type="text" name="url" size="10">
<input type=submit value="Go">

</form>


<?php

$page = $_GET['url'];

?>

<iframe name="window" src="<?php echo $page;?>"></iframe>

</body>

</html>


Hope this helped ;)

leomoon
11-18-2007, 02:13 AM
Tnx a lot my friend! :) It's a very good example.

codeexploiter
11-19-2007, 03:19 AM
You must use php, you cant do that with html only.

Instead of using PHP you can accomplish your task using JavaScript.