Chromana Posted March 26, 2006 Share Posted March 26, 2006 How do I make an iFrame in a normal HTML document have a link that, when clicked, changes the document that it is in? The main document is not an iframe.For example: <body><iframe src="menu.html"></iframe>CONTENT</body> So a link on the menu iframe changes the main document. I think it has to do with the target and name atributes but I don't know how to do it. Thanks for any help. Link to comment Share on other sites More sharing options...
smiles Posted March 26, 2006 Share Posted March 26, 2006 <iframe src="" name="showframe"></iframe><a href ="http://www.w3schools.com" target ="showframe">Link</a> try this Link to comment Share on other sites More sharing options...
Chromana Posted March 26, 2006 Author Share Posted March 26, 2006 Thank you for your reply, however I need it to be the other way round so that the link is in the the iframe and it changes the main document. Link to comment Share on other sites More sharing options...
scott100 Posted March 26, 2006 Share Posted March 26, 2006 Put this code in the ifame to change the url of the page that opened it: <input type="button" value="New Page" onclick="window.opener.location.href='http://www.google.com'" /> Link to comment Share on other sites More sharing options...
Chromana Posted March 27, 2006 Author Share Posted March 27, 2006 Thanks also for you reply. This doesn't seem to work and is it possible to do this without a butoon, and just normal text? Thanks Link to comment Share on other sites More sharing options...
UnfeelingAlloy Posted March 27, 2006 Share Posted March 27, 2006 You should be able to put this in whatever text link you have in the iframe: <a href="http://yourdestination.com" target="_top">Link Text</a> ^ That should work... Link to comment Share on other sites More sharing options...
scott100 Posted March 27, 2006 Share Posted March 27, 2006 **reconsiders post**Your iframe is embedded within the body of the document, so if you change it's source the iframe wont exist anymore. I don't think it's possible to change the page but keep the iframe. Target="_top" = that would change the whole page Link to comment Share on other sites More sharing options...
Chromana Posted March 28, 2006 Author Share Posted March 28, 2006 THANK YOU THANK YOU THANK YOU (ok that was a bit noobish )That was exactly what I needed. You see, the iframe is the menu so it will be on every page anyway, so it would exist.Thanks again, you just saved the whole layout of my site! 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