Forum Moderators: open

Message Too Old, No Replies

Having an issue with iframes, need help!

         

NewDesigner

10:56 pm on Oct 19, 2004 (gmt 0)

10+ Year Member



Hi! I'm new to web designing and I created a page using iframes. I want to be able to create a page using my buttons and have the content static on the same area. Meaning when you click on each button you won't be switched to another page. Someone recommended that I use iframes for what I wanted. I got a code from another site, yet the script works and sometimes it doesn't. I can't figure out what to do.

I created a test page at <Sorry, no personal URLs. See TOS [webmasterworld.com]>. Can someone please look at it and tell me what the problem could be? I would truly appreciate it. I've been busting my head with this for the past two days and have no idea what to do.

Thanks.

Iliana

[edited by: tedster at 12:09 am (utc) on Oct. 20, 2004]

tedster

12:23 am on Oct 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcometo the forum, Iliana.

To get links on the main page to change which document is loaded in the iframe doesn't require a script - it only takes 2 steps, and they are both in the html:

1. Give your iframe a name attribute
<iframe name="yourchosenname" src="etc. etc....>

2. Add a target attribute to every link that you want to change the iframe content
<a href="newpage.html" target="yourchosenname">text or image</a>

So whatever purpose your script has, it's something other than changing the iframe's content.

If the script is Javascript (I assume so), we also have a
Javascript Forum [webmasterworld.com] where you may be able to get some help,
assuming the script isn't too huge (see Posting Code [webmasterworld.com] for pointers
)

Jedi Vampire Coffee

10:56 am on Oct 20, 2004 (gmt 0)

10+ Year Member



That means the iframes code is basically the same as normal frames code?

NewDesigner

11:23 am on Oct 20, 2004 (gmt 0)

10+ Year Member



Can you give me an example of how the code would look like. See I was doing searches on iframes and kept coming up with sites doing javascripts for the iframes, so now I'm even more confused.

Thanks for your reply.

NewDesigner

11:30 am on Oct 20, 2004 (gmt 0)

10+ Year Member



Where would I put this in my html page
<iframe name="yourchosenname" src="etc. etc....>?

So there is not CSS call? I want to make sure that the width will expand if needed. Will it automatically do this? How about when the page is too long?

Thanks for your help. Little by litte, I'm learning and I have a lot to learn from what I'm seeing. :)

Jedi Vampire Coffee

12:19 pm on Oct 20, 2004 (gmt 0)

10+ Year Member



use a style sheet and classes for your frames. the code in the css sheet should read something like:

iframe.[class]
{
width: auto
}

That should work. just make sure your classes line up

NewDesigner

2:45 pm on Oct 20, 2004 (gmt 0)

10+ Year Member



Boy do I need to learn more about this topic.

I got the main page kind of figured out. The links though are not working. It's opening the pages in a different window.

The other thing I do not understand is what coding to put on all my other pages to make sure they are shown on the main page.

Gosh I hope this makes sense.

tedster

8:38 pm on Oct 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you want to control the styles WITHIN the iframe, call your css from that iframed document, not the parent document.

For basic learning the basics in any area of HTML, I highly recommend W3 Schools.
For instance, on iframes, see:

The iframe tag [w3schools.com]

Google search for iframe site:w3schools.com [google.com]