You can do pure Javascript for this, or you can use jQuery or another client-side library. A trip to the server would be a waste of resources. Ajax (asynchronous Javascript and XML) seems unnecessary here when client-side Javascript will do.
Using jQuery, your code will look like this:
$("#button").click(function() {
$("#myDiv").style('height','700px');
});
In addition, your styles should really be in an external CSS file. In this file you will have:
#myDiv {
position: relative;
width: 100%;
overflow: hidden;
}
.myDivStartHeight {
height: 500px;
}
.myDivNewHeight {
height: 700px;
}
Your HTML originally assigned the class myDivStartHeight(using a more semantic name) to myDiv. Then you can do:
$("#button").click(function() {
$("#myDiv").removeClass("myDivStartHeight").addClass("myDivNewHeight");
});
Javascript jQuery, jQuery.
button.onclick = function() {
var div = document.getElementById("myDiv");
if(div) {
div.style.height = "700px";
}
};
jQuery , . jQuery , , !