In this post we will discuss how we can find the body height using jQuery. Also you can check out my previous posts on:
- Single stored procedure to insert update and delete in sql server 2008
- Adding meta tags to aspx pages in asp.net
- Constants in C#.Net
We can get the body height by using the $(document).height() or by using the $(window).height() method.
Below is the full code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default13.aspx.cs" Inherits="Default13" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>get body height using jQuery in Asp.Net</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
var pageheight = $(document).height() + "px";
alert(pageheight);
var windowheight = $(window).height() + "px";
alert(windowheight);
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
After this it will appear like below:
- Single stored procedure to insert update and delete in sql server 2008
- Adding meta tags to aspx pages in asp.net
- Constants in C#.Net
We can get the body height by using the $(document).height() or by using the $(window).height() method.
Below is the full code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default13.aspx.cs" Inherits="Default13" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>get body height using jQuery in Asp.Net</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
var pageheight = $(document).height() + "px";
alert(pageheight);
var windowheight = $(window).height() + "px";
alert(windowheight);
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
After this it will appear like below: