PDA

View Full Version : How to Get IFrame Scroller to Validate



sel_nyc
02-16-2005, 06:52 PM
IFrame Scroller

http://www.dynamicdrive.com/dynamicindex2/iframe-scroller.htm

I used this script on one of my client's sites, seen here:

http://chefpierrot.com/

and here:

http://chefpierrot.com/menus/

The original script includes a javascript call which is apparently unneccessary.

Here is the original code:


//specify path to your external page:
var iframesrc="external.htm"

//You may change most attributes of iframe tag below, such as width and height:
document.write('<iframe id="datamain" src="'+iframesrc+'" width="150px" height="150px" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="1" scrolling="no"></iframe>')

The above code will not validate as HTML 4.01 Transitional at the W3C.

Their standards, in this case, proved to be both helpful and easier to implement:

The revised code looks like this (with no javascript call):


<iframe
src ="external2.htm" frameborder="0" width="150" height="200" scrolling="no"> </iframe>

This code has been tested in current versions of IE, NS, Opera & Firefox; also works in Safari and IE for Mac and it will validate as HTML 4.01 Transitional.

I did remove the legal notice within the code because I'd put a credit for the script on the bottom of every page of the site, even though the script is only used on two of its 31 pages.

I hope this is OK with you guys, but I wanted to check with you and make sure. If you need me to change it, just let me know--I don't want you guys steamed at me, your stuff is too good.

Edit: I should mention that the credit in the code does remain in the external file.

Thanks for the scripts, you guys are making me look good.

ddadmin
02-16-2005, 11:13 PM
Hi:
Thanks for the info on validating this script. Regarding the alternate arrangement for giving credits for this script, that's fine as well. :)

Good luck,

sel_nyc
02-17-2005, 12:46 AM
Thanks! You guys are the best!