Click to See Complete Forum and Search --> : Adding bg color and text to a iFrame
Dark Dragon
09-22-2003, 10:24 AM
I have an iFrame which I have adjusted to suit my needs..however I want to alter the background color of it AND I want to add text directly to the iFrame.
I could just make a page and have it link to my iFrame but I want the text to be centered no matter what size window it is.
Below is my iFrame code:
<iframe name="myIframe" frameborder="1" vspace="1" hspace="1" marginwidth="1"
marginheight="1" width="45%" height="50%"
scrolling="no"></iframe>
I like the iFrame stats the way they are but I tried adding bg color tags to it, similiar to the other tags that control its hieght and all.
Is there a relatively painless way to do this? Thanks
hammerslane
09-22-2003, 10:37 AM
i always thought that you had to have an SRC tag when using iframe - like src="red_background_document.html" and red_background_document.html had the <body bgcolor=red> tag in it? that's the only way i'm aware you can do it... :confused:
l8rz
Dark Dragon
09-22-2003, 10:47 AM
When it comes to iFrames, it is a bit different I think. However I don't want a tiled background in this case, just a solid color, like black, but the code I am using now came from one of those O'Reilly books about DHTML and Javascript.
I found a nice code for a iFrame but am struggling with having a bg color and text. And because it is all contained in the iFrame tags..there has got to be a way to add these attribute..I hope ;)
DaveSW
09-22-2003, 11:06 AM
You are supposed to use the src attribute...
The only time you don't need it is if you're targetting a hyperlink to an image, and then you can load that into an iframe without using src.
Dark Dragon
09-22-2003, 11:09 AM
Okay..but what about adding text to it?
But I really do not want to create a separate page just for the iFrame color..I thought one could add the bg color thing in the code..of course I tried it and it didn't work..bummer
So it would look like this?
P.S..Thanks
<iframe name="myIframe" body bgcolor="black" frameborder="1" vspace="1" hspace="1" marginwidth="1"
marginheight="1" width="45%" height="50%" src="black_background_document.html
scrolling="no"></iframe>
DaveSW
09-22-2003, 11:20 AM
Yes if you closed your src quotes
you need to make a new page for every different thing you wish to display in the iframe, unless it's one image that you don't need to control background or position of.
Dark Dragon
09-22-2003, 11:26 AM
Okay..thank you.
so now I closed the quotes but now I have to make a blank, black colored page for the iFrame, right? So I may as well just add the text to that...nuts..I was so sure there was another way.
Anywhoo, thanks for the info.