Jump to content

iFrame


tissot
 Share

Recommended Posts

Hi all!my main page has an iFrame (another page will display in the iFrame)if theres a link in the page from the iFrame, and when i click the link... it changes the page in the iFrame to another, instead of opening a new window or changing the whole page to another by clicking a link in the iFrame, but the question is how? :)hope i make sense to u peeps

Link to comment
Share on other sites

main.html

<html><head>	<title>...</title>	<meta http-equiv="Content-type" content="text/html; charset=UTF-8" /></head><body>	This is the main page	<br/>	<iframe src="framedpage.html" style="width:100%;height:400px"></iframe></body></html>

framedpage.html

<html><head>	<title>...</title>	<meta http-equiv="Content-type" content="text/html; charset=UTF-8" /></head><body>	This is the framed page page	<br/>	<a href="http://www.google.com" target="_parent">click</a>	<br/>	<a href="http://www.google.com" onclick="parent.location = this.href">standards click</a></body></html>

Both links on framedpage.html will work but only the second one will validate to strict xhtml because in xhtml the target attribute is depreciated.

Link to comment
Share on other sites

Alright, it works but when I clicked a link from the iFrame, it changed the whole page to another page but with the same regular frames (I use regular frames for left and right sides of the page) :SI mean, whats the code to make it no frame when clicking a link from the iFrame?Thanks

Link to comment
Share on other sites

FINALLY, IT WORKS I LOVE YOU <333Oh wait, I need a bit help again.from what u said

<a href="http://www.google.com" onclick="top.location = this.href">standards click</a>

But is there another code with the same method for iFrame in the page, rather than adding that code in the framed page?for example:

<iFrame src="newscontent.html" onclick="top.location = this.href">standards click</a>that will occur only if clicked inside the iFrame then the whole page will be change to another page

because I have a page that has ASP codes in it and I'm going to use that page in the iFrame

Link to comment
Share on other sites

Ok, that's ok!Well, in the framed page displaying in the iFrame, there's a code I have

<input type="submit" value="Insert record">

That's a button, so when I clicked it, same problem occured.. (like what I said before, If i clicked it.. the page in the iFrame changes to another page in the iFrame without changing teh whole page)so is it possbile to add onclick to that code or something smiliar?thanks

Link to comment
Share on other sites

main.html
<html><head>	<title>...</title>	<meta http-equiv="Content-type" content="text/html; charset=UTF-8" /></head><body>	This is the main page	<br/>	<iframe src="framedpage.html" style="width:100%;height:400px"></iframe></body></html>

framedpage.html

<html><head>	<title>...</title>	<meta http-equiv="Content-type" content="text/html; charset=UTF-8" /></head><body>	This is the framed page page	<br/>	<a href="http://www.google.com" target="_parent">click</a>	<br/>	<a href="http://www.google.com" onclick="parent.location = this.href">standards click</a></body></html>

Both links on framedpage.html will work but only the second one will validate to strict xhtml because in xhtml the target attribute is depreciated.

I wonder if the code only can be run in IE?because when i try with firefox, it doesn't run.Thx.
Link to comment
Share on other sites

with firefox, when i click on the link, the google page is opened not in the iframe, but the whole page change to google page. But when i used IE, there's no problem. Or maybe there're some setting in Firefox that i have to change?

Link to comment
Share on other sites

Can someone help me, i learn to create a page and i have a problem.i want to create a page with iframe and some link outside the iframe.What i want is when i click on the link, the content of the link will be displayed in the iframe.I know that i can used target="nameOfIframe" to do that. But can i use "onclick" to do it.What is the code for that?Thanks in advance for the help.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...