View Full Version : html question
Panic!
May 13th, 2007, 10:48 AM
Is it possible to open a link in a div? Like the div is on the page and you click a link and it opens in the div. I've been trying to figure this out most of the day and it's bugging me now. Any help is appreciated. Thanks
rize
May 13th, 2007, 10:50 AM
uhm if u mean target links like frames u cnt..
ahhh i dont get what u mean any samples?
wce
May 13th, 2007, 10:51 AM
I don't think you can do that. You would need to use an iframe for that purpose.
Panic!
May 13th, 2007, 10:54 AM
Ah damn back to coding :( Thanks anyway.
Ajay
May 13th, 2007, 10:54 AM
you could do it by using php, but not with a plain div. the only other solution is iframes, but iframes are bad.
rize
May 13th, 2007, 10:57 AM
yeah.. u cn use php includes.. its something like iframe but its different
im bad in explaining
Panic!
May 13th, 2007, 11:06 AM
Thankyou :)
Greg-J
May 14th, 2007, 04:05 PM
What is it exactly that you're trying to accomplish?
Panic!
May 14th, 2007, 04:08 PM
I'm using iframes now but I was basically trying to open content pages in the main div.
niktesla
May 15th, 2007, 01:24 PM
you could do it with javascript. write a function that reads the content of the destination page (parse the code between <body> tags), make sure the div has overflow: auto, then write the content inside the div. it seems to me that it is much more difficult than using an iframe, but if for some reason an iframe can't be used that will work as a solution.
Greg-J
May 16th, 2007, 10:00 PM
you could do it with javascript. write a function that reads the content of the destination page (parse the code between <body> tags), make sure the div has overflow: auto, then write the content inside the div. it seems to me that it is much more difficult than using an iframe, but if for some reason an iframe can't be used that will work as a solution.
It's a little more involved that writing a single function unfortunately. If someone is asking how to" open a web page in a div" they are obviously new to this field so throwing over simplified yet complex solutions with no insight out there doesn't do a lot of good. If you're going to give an explanation, try to make it more informative.
You could do it in AJAH (you can call it AJAX, whatever) fairly easily and you can use a premade script if you aren't versed in JS. A good one for novice developers can be found at dynamic drive (http://dynamicdrive.com). Specifically this AJAX tabs content script (http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/index.htm). It will preserve your site index and no search engine will see the page any different which makes it a superior solution to an iframe.
If you're absolutely married to the idea of using an iframe there is another peice of code on dynamic drive called the iframe SSI script II (http://www.dynamicdrive.com/dynamicindex17/iframessi2.htm) that will adjust your iframe's height to the height of the page it is holding.
If you need any more help beyond that, feel free to ask.
deep
May 16th, 2007, 10:05 PM
I'm using iframes now but I was basically trying to open content pages in the main div.
javascript would be the solution but its complicated so the easiest way is iframes :)
marshall_26
May 20th, 2007, 04:44 AM
I vote iframes... unless you got the time to play with ajax "which is far more advanced"
Assailant
May 20th, 2007, 04:58 AM
you can easily do this with dhtml
Greg-J
May 20th, 2007, 09:22 PM
There's no excuse to use iframes anymore. "AJAX" is not difficult and there are many, many reliable and easy to work with frameworks and pre-rolled scripts out there like the one I posted to use iframes.
vBulletin® v3.7.1, Copyright ©2000-2008, Jelsoft Enterprises Ltd.