‘ HTML ’ category archive

How to make a textarea readonly?

July 05, 08 by the programmer

It’s very simple, all you have to do is add the attribute readonly.

This is how it looks:

<textarea readonly=”readonly”>This is some text in the text area</textarea>

That’s it

IFrame with no border

May 21, 08 by the programmer

So you want your IFRAME without borders a?

You probably tried border=”0″ and it did not work.

If you want to make an iframe without a border you have to set the following attribute

frameborder=”0″

That’s it.

Look at the attribute in the real iframe bellow

<iframe name=”frame_name” src=”http://minanov.com” width=”100%” height=”500frameborder=”0″ ></iframe>

Breaking out of an iframe

May 17, 08 by the programmer

This script will open a page that starts loading inside the iframe in the parent window above the iframe.

Just copy this javascript code in the page header that should break out of the iframe, and that’s it.

Everytime a page that has the bellow code in the header loads in an iframe it will automatically pop out of the iframe and start loading in the parent window.

<script language=“JavaScript” type=“text/javascript”>
function breakout_of_frame() { 
   if (top.location != location) { 
      top.location.href = document.location.href ; 
   } 
} 
breakout_of_frame();
</script>

Transparent iframe background

May 17, 08 by the programmer

Hi,

I was inluding an iframe in a web page and I noticed that the iframe does not have the same background color as the page it was on.

So if you want an iframe to have the same background color as the surrounding environment this is how it’s done:

Step 1

Set the iframe attribute allowtransparency to true

<iframe src=”some_page_to_incude_in_the_iframe.html” allowtransparency=”true”></iframe>

Step 2

In this step you should put the following style in the include page. This tells the page that you include in the iframe to have a transparent background. That means to show the background bellow it. In our case this is the background of the page that the iframe is on.

<style type=”text/css”>

body {

background: transparent;

}

</style>

I hope this will solve some problems.