View Full Version : onClick Change the Height and Width to Fullscreen of DIV

09-03-2011, 06:52 PM
Hello My All Dear Friends!
I am very new to java.And I need to a little thing with java I hope you awesome guys could do it.

For example there is a div width some id.When I click some button it should be maximized to full screen with fixed position and 100% height and width.I have tried below code for this propose But it don't work for me in site..:confused::confused::confused:


#someId {
display: block;
background-color: black;
color: white;
width: 100px;
height: auto;


<script type="text/javascript">
function changeWidth(elemId, w){
var elem = document.getElementById(elemId);
elem.style.width = w;

<input type="button" value=" Change Div Width " onclick="changeWidth('someId', 500);" />

<input type="button" value=" Back To Orignal " onclick="changeWidth('someId', 100);" />

<div id="someId">
Div content.......


Please Help
Thanks In Advance