PDA

View Full Version : Open link i div.


RonnyB
11-08-2008, 10:47 AM
Hi

Hope someone can help me
How do i get a link to open a html doc. in a specifik div :confused:

RonnyB
11-08-2008, 02:59 PM
Nobody Can help me with this ?

coloeagle
11-08-2008, 03:17 PM
Can you give us more details on what you are wanting to do?

RonnyB
11-08-2008, 04:42 PM
well
I want my links on my website, to open in a div, like a window,or a frame.

you know if i had a link called "members", they will come on the site with out popup a new site.

just like linking in a frame just in a div instead

Maby it cant be done ?

coloeagle
11-08-2008, 05:07 PM
OK, think I have you now. I have something that might be what you are wanting. Give me an hour or so and I will post it to my website for you to look at.

coloeagle
11-08-2008, 06:20 PM
Take a look at this. Hopefully it is what you are after or maybe close.
validwebdesigns.com/construction/test.html

RonnyB
11-08-2008, 06:24 PM
Yea thats close to what i want, but can it be done with the text(link) outside the same div ?

how did you do it ?

coloeagle
11-08-2008, 06:31 PM
ooh, not sure. I will need to do some playing around with it. Getting ready to go meet the wife for lunch and an afternoon movie. I'll give it some thought and play with it when I get back home.

coloeagle
11-08-2008, 09:08 PM
Just what the doctor ordered, I needed a break from the comp and coding stuff. :confused:

I was looking at this too hard. Scratch the earlier example.

It in reality is simple to do. :smile:

Just create an iframe, name it and then use the target attribute on the links for the pages you want to have displayed inside the iframe.

RonnyB
11-09-2008, 12:47 PM
Thanks for the help, but what is a iframe ? is that the exact name of it ?

coloeagle
11-09-2008, 02:04 PM
iframe (short for inline frame) is used to display a html or similar document inside an exisitng web page. Inline means just that, it allows you to display information with-in or inline with your existing webpage information. This is fairly popular with affiliate websites having the information displayed on your website.

You specify the size of the frame, setting the width and height. You can decide if you want it to have separate scroll bars or not. Border or no border.

Here is an example of an iframe;

<iframe src="http://the document to be displayed.html" width="200" height="200"> Place alternative text here for browsers that do not understand or display iframes. </iframe>


In the example above I have given the iframe a width of 200px and a height of 200px. The text "Place alternative text here for browsers that do not understand or display iframes." is only displayed when a browser does not support frames or if a user has frames disabled. You can place alternative information here as well.

By default an iframe has a border to remove the border you would add frameborder="0" inside the opening tag.

RonnyB
11-09-2008, 02:45 PM
Hi again
I found out how to make an iframe.
but how do you get links to open in it ?

coloeagle
11-09-2008, 07:24 PM
You will need to start with giving the iframe a name such as "news".

<iframe name="news" style="width:300px; height:300px;">Alternate text </iframe>Then in your links you will use the "target" attribute using this name.
<a target="news" href="page to be displayed.html">My news ticker page</a>You can have as many links as you need to display inside the iframe as long as each link uses the target name. You can have multiple iframes on a page, each needs to have a different name.

RonnyB
11-10-2008, 01:56 PM
Hi again
Is there any problem with making the iframe in a div ?

So i can have it over another image, cause i can get it to work, just not in a div

domedia
11-10-2008, 02:24 PM
Hi again
Is there any problem with making the iframe in a div ?

So i can have it over another image, cause i can get it to work, just not in a div
A DIV is just another element, so no problems.

RonnyB
11-11-2008, 01:50 PM
Hi
I have a problem
i made this line: <div id="viser"><iframe>name="news" style="width:1200px; height:300px;">Alternate text</iframe></div>

but the width and height dont work with this, what is wrong ?

domedia
11-11-2008, 02:28 PM
You're closing the starting iframe tag before you even get to the width and height :)

RonnyB
11-12-2008, 01:49 PM
Sry im not good at this.
Can you hlp me with the line ?

domedia
11-12-2008, 01:51 PM
just remove the '>' closing bracket right after the word 'iframe'.

RonnyB
11-12-2008, 02:24 PM
Ahh got that to work =) can you give me a example for a link allso ?

i have this
<div id="apDiv2"><strong><span class="style1">Medlemmer</span></strong></div>

and need to point it to the iframe
<div id="viser"><iframe name="news" style="width:645px; height:440px;">Alternate text</iframe></div>

and open a html in it

RonnyB
11-12-2008, 02:56 PM
ps
how do i get the border on the iframe away ?

coloeagle
11-12-2008, 10:20 PM
ps
how do i get the border on the iframe away ?As mentioned in an earlier post. To remove the border you need to add frameborder="0" to the iframe.

set your link;
<div id="apDiv2"><strong><span class="style1"><a target="news" href="medlemmer.html">Medlemmer</a></span></strong></div>

RonnyB
11-13-2008, 03:13 PM
Hi
Got it all to work now.

Many many thanks for the help guys.