14 Kasım 2010 Pazar

To Determine the Size Of a Division Dynamically

I just add a option to my Google Extension that user can set the size of the application while he is using it. Here is the my work and the way to have this ability in my appli.

First assume we have a element in html that have the attribute " id = 'map' ".

First we add a new division to have three radio buttons to be selected for setting size.


<div id="options">
<form>
<input type="radio" name="size" onchange="setSize(400px, 600px)">400x600
<input type="radio" name="size" onchange="setSize(600px, 800px)">600x800
<input type="radio" name="size" onchange="setSize(100%, 100%)">FullScreen
</form>
<div>


We call setSize(--) function when we select one of the radio button. Then it is the time to define the setSize(--) function.



function setSize(h,w){
document.getElementById("map").setAttribute("style","height:"+h+"; width:"+w+";");
}



that is all...

Hiç yorum yok:

Yorum Gönder