tissot Posted June 26, 2006 Share Posted June 26, 2006 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 More sharing options...
aspnetguy Posted June 26, 2006 Share Posted June 26, 2006 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 More sharing options...
tissot Posted June 26, 2006 Author Share Posted June 26, 2006 Thanks so much, I will try it now Link to comment Share on other sites More sharing options...
tissot Posted June 26, 2006 Author Share Posted June 26, 2006 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 More sharing options...
aspnetguy Posted June 26, 2006 Share Posted June 26, 2006 do both links do that?try this <a href="http://www.google.com" onclick="top.location = this.href">standards click</a> Link to comment Share on other sites More sharing options...
tissot Posted June 26, 2006 Author Share Posted June 26, 2006 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 More sharing options...
aspnetguy Posted June 26, 2006 Share Posted June 26, 2006 I tested it and the onclick event doesn't seem to work on an iframe. Sorry Link to comment Share on other sites More sharing options...
tissot Posted June 26, 2006 Author Share Posted June 26, 2006 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 More sharing options...
aspnetguy Posted June 26, 2006 Share Posted June 26, 2006 you could do this with a button <input type="button" onlcick="top.location='enter your url here'" value="Click Me"/> Link to comment Share on other sites More sharing options...
tissot Posted June 26, 2006 Author Share Posted June 26, 2006 you could do this with a button<input type="button" onlcick="top.location='enter your url here'" value="Click Me"/> <{POST_SNAPBACK}> Thanks a lot. Link to comment Share on other sites More sharing options...
dlaidi Posted June 27, 2006 Share Posted June 27, 2006 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. <{POST_SNAPBACK}> 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 More sharing options...
aspnetguy Posted June 27, 2006 Share Posted June 27, 2006 it works fine in FireFox. Are you sure you set it up correctly. What problems are you getting? Link to comment Share on other sites More sharing options...
justsomeguy Posted June 27, 2006 Share Posted June 27, 2006 <iFrame src="newscontent.html"Just a side note, to be strictly correct the tag name should be all lowercase. This only matters if you specify strict XHTML (I think). Link to comment Share on other sites More sharing options...
dlaidi Posted June 28, 2006 Share Posted June 28, 2006 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 More sharing options...
aspnetguy Posted June 28, 2006 Share Posted June 28, 2006 that is the whole point. To have the link take over the whole window. That is what they wanted Link to comment Share on other sites More sharing options...
dlaidi Posted June 28, 2006 Share Posted June 28, 2006 ic, sorry i missunderstood the problem Link to comment Share on other sites More sharing options...
dlaidi Posted June 29, 2006 Share Posted June 29, 2006 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 More sharing options...
justsomeguy Posted June 29, 2006 Share Posted June 29, 2006 Look up the javascript window.open function, there's a place where you specify the target. Link to comment Share on other sites More sharing options...
dlaidi Posted June 30, 2006 Share Posted June 30, 2006 Thanks for the info.. i'll try to find some tutorial about that. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now