...

View Full Version : xhtml frames



Nick
10-22-2002, 12:45 PM
I'm having trouble setting up a frameset and keeping it to the xhtml frameset format..


http://www.abdn.ac.uk/~u14nw2/

Basically I've had to put framespacing into the frameset part of the html but this isn't allowed... and if i remove it i'm left with a white space. Any ideas on how to fix this would be great :)

<frameset cols="85,*,245" framespacing="0">
<frame src="nav.htm" name="leftFrame" scrolling="no" frameborder="0" noresize="noresize"/>
<frame src="news.htm" name="mainFrame" frameborder="0" />
<frame src="link.htm" name="rightFrame" scrolling="no" frameborder="0" noresize="noresize"/>
</frameset>

Alex Vincent
10-23-2002, 03:23 AM
Hm. Here's a couple of ideas:

(1) Examine the rules for spacing in CSS. Maybe you can add a CSS property to help out, bound to the frame element.

(2) Maybe (although this is highly unlikely) you're getting whitespace from between the elements. Try removing it, see what happens.

Sorry I can't be of more help here. :(

Nick
10-24-2002, 12:05 PM
Thanks Alex. I think I'm just going to have to change the whole design of the site.. or downgrade (is that the right word) to html 4.1

The site if for me to practice on so its meant to evolve :)

dauvm
10-26-2002, 09:21 PM
hey c'mon nick don't give up yet :)

I am not sure exactly what you're talking about, is the white space on the left frame or the right frame?

the css for padding would be style="padding:0" you can try adding that in to some stuff and seeing if it will validate. I personally don't use frames too often so I'm not sure what you're talking about... but your site looks pretty good to me.

I just got done a project taking a 5 page website coded entirely in frontpage and rewriting it in xhtml 1.0 and valid css... if I can do that, you can do this!

good luck.

-Doug

Nick
10-28-2002, 11:17 AM
hehe ok dauvm you've inspired me. I'll keep working on it and I'm going to look into the css thing sometime this week when i get the chance.

aznrocket
06-17-2005, 05:01 AM
sorry for digging up an old post


hehe ok dauvm you've inspired me. I'll keep working on it and I'm going to look into the css thing sometime this week when i get the chance.

Have you got a solution to your problem Nick?

I checked your site, and it looks like you don't use frames anymore :P

I have the same problem ...

http://stw.ryerson.ca/~m4yip/transit/index.html
This uses <frameset rows="25,450,25" frameborder="0">, which is a no-no to xhtml1.0 because only rows & cols can be used with frameset. However, it is the look that I want, i.e. no white frame strips.

http://stw.ryerson.ca/~m4yip/transit/index2.html
I've taken out frameborder="0", and it validates, but the white strips usually shown on frames appear now ... :mad:

What can I do?

I'm thinking it's something with the css, but I don't know what to do to the frameset in the css. Setting border-style and padding to none/0 doesn't work ...

Any suggestions?

sesshyzkidz
06-17-2005, 05:31 AM
You're setting "frameborder" on the wrong element. It should be on the frame element. Here's an except from the XHTML1-Frameset DTD:


<!ELEMENT frame EMPTY>
<!ATTLIST frame
%coreattrs;
longdesc %URI; #IMPLIED
name NMTOKEN #IMPLIED
src %URI; #IMPLIED
frameborder (1|0) "1"
marginwidth %Pixels; #IMPLIED
marginheight %Pixels; #IMPLIED
noresize (noresize) #IMPLIED
scrolling (yes|no|auto) "auto"
>
- taken from http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_XHTML-1.0-Frameset

aznrocket
06-17-2005, 02:30 PM
You're setting "frameborder" on the wrong element. It should be on the frame element.
- taken from http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_XHTML-1.0-Frameset

In index2.html, I do set frameborder="0" inside the frame element, i.e.

<frameset rows="25,450,25">

<frame noresize="noresize" src="top.html" frameborder="0" />
<frame noresize="noresize" src="middle.html" name="middleframe" frameborder="0" />
<frame noresize="noresize" src="bottom.html" name="bottomframe" frameborder="0" />

</frameset>
The result is that the frame strips show, and I don't want that.

Is there anything else I can do, or is that how frames have to be?

sesshyzkidz
06-17-2005, 04:39 PM
You could set the marginheight and marginwidth attributes. They are equivalent to the dead framespacing attribute.

Previous usage:
<frame src="src.html" framespacing="0">

New usage:
<frame src="src.html" marginheight="0" marginwidth="0"/>

aznrocket
06-17-2005, 05:09 PM
Ah ... I see

Thanks sesshyzkidz!

I will try that when I get home tonight.

[edit]

hm ... so, it becomes

<frameset rows="25,450,25">

<frame noresize="noresize" src="top.html" marginheight="0" marginwidth="0" />
<frame noresize="noresize" src="middle.html" name="middleframe" marginheight="0" marginwidth="0" />
<frame noresize="noresize" src="bottom.html" name="bottomframe" marginheight="0" marginwidth="0" />

</frameset>

Still doesn't get rid of my problem.

See http://stw.ryerson.ca/~m4yip/transit/index3.html vs. http://stw.ryerson.ca/~m4yip/transit/index.html :(

I appreciate the help though ...

Does anyone know how to properly get rid of those frame strips?

dstanley
08-08-2005, 05:30 PM
Hi sorry to dig up again but i am also searching for the solution to this problem

I have 2 white strips between middle frame and the top and bottom frames,

have you managed to solve this as i noticed that there are no white gaps in your second link aznrocket

pavolk
08-15-2005, 02:06 AM
When I put frameborder="0" back in the frameset element (which we're not supposed to do) it fixes the white stripe in Firefox, but not in IE6. Anybody else get a solution to this? It seems that the white stripe has to be there if we want to use frames - surely a whopping flaw in xhtml?

dstanley
08-15-2005, 06:24 AM
I just inserted border="0" into the frameset tag and it fixed it, however it won't validate.

I accepted defeat on the issue, the frames look fine though, pity it couldn't have been achieved with validation.

pbrazina
02-17-2008, 04:42 AM
Well I decided to think in a differnt approach since I want all of my pages to be valid XHTML 1.0 transitional pages, but I don't want to give up frames.

I will show you the changes I made.

ORIGINAL CODE:

<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Phillydog's Webpage</title>
<meta name="DESCRIPTION" content="A place where you can get the newest HTML tricks, or trade non-sport cards!" />
<meta name="KEYWORDS" content="Philip, Brazina, phillydog" />
</head>
<frameset id="fmain" cols="175,*">
<frame name="Menu" src="bar.html" scrolling="auto" frameborder="0" noresize="noresize" marginwidth="10" marginheight="10" />
<frame name="Content" src="main.html" scrolling="auto" frameborder="0" marginwidth="3" />
</frameset>
</html>

MODIFIED CODE:

<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Phillydog's Webpage</title>
<meta name="DESCRIPTION" content="A place where you can get the newest HTML tricks, or trade non-sport cards!" />
<meta name="KEYWORDS" content="Philip, Brazina, phillydog" />
<script type="text/javascript">
<!--
var nVer = navigator.appVersion;
var nAgt = navigator.userAgent;
// In Internet Explorer, the true version is after "MSIE" in userAgent
if ((verOffset=nAgt.indexOf("MSIE"))!=-1) {
browser_spec='framespacing="0"';
}
// In Firefox, the true version is after "Firefox"
else if ((verOffset=nAgt.indexOf("Firefox"))!=-1) {
browser_spec='border="0"';
}
// In Opera, the true version is after "Opera"
else if ((verOffset=nAgt.indexOf("Opera"))!=-1) {
browser_spec='border="0"';
}
// In Netscape, the true version is after "Netscape"
else if ((verOffset=nAgt.indexOf("Netscape"))!=-1) {
browser_spec='border="0" framespacing="0"';
}
// In Safari, the true version is after "Safari"
else if ((verOffset=nAgt.indexOf("Safari"))!=-1) {
browser_spec='border="0" framespacing="0"';
}

// In other browsers
else if ( (nameOffset=nAgt.lastIndexOf(' ')+1) < (verOffset=nAgt.lastIndexOf('/')) )
{
browser_spec='';
}
document.write('<frameset id="fmain" ' +browser_spec+ ' cols=\"175,*\">'+
'<frame name="Menu" src="bar.html" scrolling="auto" frameborder="0" noresize="noresize" marginwidth="10" marginheight="10" />'+
'<frame name="Content" src="main.html" scrolling="auto" frameborder="0" marginwidth="3" />'+
'</frameset>');
// -->
</script>
</head>
<body>
</body>
</html>

Basically I am using the DTD for XHTML pages rather than the DTD for FRAMESETs and then I am using javascript to populate the entire frameset + frames.

Using conditions, I can add the 'framespacing="0"' for IE, 'border="0"' for firefox, a condition for Opera, and then 'other'. The 'other' is what the XHTML validation from w3c uses.

This works for IE 5.5/6.0/7.0, Firefox 1.5/2.0, Opera 9.2x, , Safari 1.x/2.x/3.x, Gecko (according to browsershots.org).

I hope this helps, and if so, perhaps one of you guys can help me when I have an issue in the future.... I still have my 'font-face' issues using custom fonts with FF.

If it works, drop me a line and let me know.

hemebond
02-17-2008, 12:22 PM
That's not valid XHTML. At all. Your Javascript content is not escaped correctly and you can not use document.write in an XML document.

Using Javascript to get around having to create valid documents is not the way to go. Use HTML. All of you. Including you OP. If you're using XHTML I guarantee you're using it wrong.

pbrazina
02-17-2008, 01:45 PM
Honestly I wish I could use entirely 100% value XHTML. Due to the fact that frames are being phased out and the fact that whomever created the DTD messed up with the framespacing, has caused most of us (with the issue above) to do the following:

1.) Avoid frames entirely
2.) Find a way around the framespacing issue and 'trick' the validator.

This does validate with w3c.org just fine. You can either save the code or validate using http://phillydog.dynu.com/index_2.html

I have my main website (which is what I used this demo on), as well as several sitelets. All of my new sitelets are frameless and either menu driven passing in a variable in the URL to display where I need in the menu, or they display thumbs on the left side with the pic on the right. This is of course using tables and not frames.

I have an older site http://phillydog.dynu.com/events/gates/ that uses thumbs in one frame, and the main pic (that you click in the thumbs bar) and it puts it to the main frame. I have to do it this way as I am not aware of how to keep my place in my javascript scrollbar. Once I refresh the (entire) page or the frame with the thumbs, the scroller goes all the way back to the left.

I can't speak for other people, however if I could overcome that issue, then I could get rid of frames for those sitelets (about 5).

For my main website, I would like to have any and all concepts down with those sitelets, and then I can convert my main site.

Another board suggested I use INCLUDES which is PHP. My goal is to only be using XHTML/CSS/JS. Someone had also suggested there iFrames, which is a nifty idea, but unless things have changed they only work in IE.

I am willing to listen to any and all comments on how to do this properly, but on all of the other websites I have read in regards to this issue, the answer that I see is 'get rid of frames'. Please help.


That's not valid XHTML. At all. Your Javascript content is not escaped correctly and you can not use document.write in an XML document.

Using Javascript to get around having to create valid documents is not the way to go. Use HTML. All of you. Including you OP. If you're using XHTML I guarantee you're using it wrong.

hemebond
02-18-2008, 06:44 AM
This does validate with w3c.org just fine. You can either save the code or validate using http://phillydog.dynu.com/index_2.htmlIf by validate you mean "displays no errors or content when parsed as XHTML" then yes, it does "validate".

Deacon Frost
02-18-2008, 11:13 AM
1.) Avoid frames entirely
2.) Find a way around the framespacing issue and 'trick' the validator.


That really offends me. The idea behind having valid sites isn't just to have them valid, it's something that other people don't get frustrated with. (X)HTML was put together because people were getting annoyed by how chaotic everyone's code was.

Don't find ways around that, either stick with just 4.01, and don't go XHTML at all, or stay well within the guidelines.

Furthermore, Frames are being depreciated, I would advise staying away from them and tables almost entirely. Frames completely, tables for very MINOR presentational needs. Other than that, do everything in your CSS file, and in (X)HTML strict (if you don't use any tables or other presentational data) or Transitional if you're going the route of some more inbound coding.


Also, congrats on the 6 year old gravedig, that's quite the forum browsing.

pbrazina
02-18-2008, 03:46 PM
When I said they are validated with XHTML, I should have stated XHTML 1.0 Transitional.

In order for me to move from frames, I have to atleast have tables. I do not know how to get around that. I have a few types of sites.

http://phillydog.dynu.com/events/vacation/vac5/ (frameless, mostly JS based)
http://phillydog.dynu.com/events/pw20060713/ (frameless, mostly JS based)
http://phillydog.dynu.com/events/gates/ (frames)

The top two are not a problem other than they use tables. I am not sure how to get around that. As for the last one (gates), I do not know how to code this where I can have my JS-based scroll bar for the thumbs and when a pic is clicked, have it display above. If I don't use frames, then when the page gets refreshed, the scroll bar goes all the way to the original position of left. I am not sure how to get around this.

When I design a page, I don't mind optimizing it, but once the page is done, I don't like to change the GUI appearance of it. Just my preference.

Assuming I did want to go a step backwards and change from XHTML 1.0/Transitional --> HTML 4.01..... techincally, I would just need to change the following lines, right?

<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">


To my knowledge, XHTML is a stricter version of HTML so anything that works in XHTML should work in HTML. I am not trying to be stubborn, but after taking a year to convert my sites to XHTML (based on perhaps incorrect data of HTML being phased out), I really don't want to have this big project of converting everything back again.

If it is only those lines above, I can simply use a search/replace tool to do it.

I do understand that my 'work-around' above to trick browsers and be XHTML compliant is ONLY for XHTML 1.0 transitional. Anything higher would fail.

Using browsershots.org, it displayed fine in all major browsers fine (IE, FF, Netscape, Opera, Safari) since it is parsing the XHTML 1.0 transitional as HTML.

I do thank all of you (despite I may be set in my ways) for all of the suggestions and comments. The other board I posted on were mean in their comments since they must have more web design experience than I do. They had suggested using PHP includes. This sounds like a nifty idea, but my goal is to only use HTML, CSS, and JS. Basically, anything that native IIS or apache can support (since I host the webserver) without any add-ons (i.e PHP, perl, CGI, etc.....). While PHP includes are not hard, I like to know a language intimately before I start using it 'live'. I don't have time at the moment for PHP as I have been battling with SquirrelMail for awhile now since the version I am using is having issues with my version of PHP..... anyways, that is another thread.

Using the simple example above with my suggestion in tricking the browser, would anybody be able to give me a valid example of getting the same results without using frames -or- tables? I do consider myself fluent in HTML and pretty good in CSS, but I have no clues as to how to do this.

Also, based on comments above (the two above this post), can any of you guys tell me where I can validate other than w3.org that might show me my code is actually wrong for HTML or XHTML?

Thanks again.

hemebond
02-19-2008, 10:14 AM
When I said they are validated with XHTML, I should have stated XHTML 1.0 Transitional.Which I can't really hold against you because even the W3C spouts this crap about "transitional" document formats. It's bollocks though, so ignore it.
In order for me to move from frames, I have to atleast have tables.No you don't.
Assuming I did want to go a step backwards and change from XHTML 1.0/Transitional --> HTML 4.01..... techincally, I would just need to change the following lines, right?No. First of all, HTML 4.01 is not a "step backwards" from XHTML 1.0. They are the same thing only one is in XML. And just because a new version of a spec is released does not make existing specs any less valid.
To my knowledge, XHTML is a stricter version of HTML so anything that works in XHTML should work in HTML.No, it's the XML version of HTML and, contrary to what a lot of website do/say, changing between them is not a simple find/replace.
I am not trying to be stubborn, but after taking a year to convert my sites to XHTML (based on perhaps incorrect data of HTML being phased out), I really don't want to have this big project of converting everything back again.The thing is, your sites aren't actually valid XHTML. I know the W3C validator probably says it is, but unfortunately it's wrong.
I do understand that my 'work-around' above to trick browsers and be XHTML compliant is ONLY for XHTML 1.0 transitional. Anything higher would fail.As I said above, it's not valid XHTML. Or HTML. The second it's parsed as XML is breaks horribly.
This sounds like a nifty idea, but my goal is to only use HTML, CSS, and JS. Basically, anything that native IIS or apache can support (since I host the webserver) without any add-ons (i.e PHP, perl, CGI, etc.....).Those pages you posted links to above are quite simple pages; you've just over-complicated them.
Using the simple example above with my suggestion in tricking the browser, would anybody be able to give me a valid example of getting the same results without using frames -or- tables? I do consider myself fluent in HTML and pretty good in CSS, but I have no clues as to how to do this.I'll see what I can do.
Also, based on comments above (the two above this post), can any of you guys tell me where I can validate other than w3.org that might show me my code is actually wrong for HTML or XHTML?Configure your Apache web server correctly and give your pages a .xhtml extension. It will serve them with the correct MIME type and you'll see the problems quickly enough. Also, I've found the WDG HTML Validator (http://www.htmlhelp.com/tools/validator/) to be stricter in its validation.

DELOCH
02-20-2008, 10:52 PM
XHTML can be
XHTML strict
XHTML transitional
XHTML frameset

the thing you at looking at is XHTML 1.0 Frameset, switch to it and you should validate nicely

oesxyl
02-20-2008, 11:05 PM
Also, I've found the WDG HTML Validator (http://www.htmlhelp.com/tools/validator/) to be stricter in its validation.

more strict seems to be:

http://webxact.watchfire.com/

best regards



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum