how to get page's width and page's height

hi all.......

i created a user control function in .ascx file which contain a button, it display a message in <div>, and i include this user control file into many web pages, but the div display's position is vary because the height in each page is different...

so how can i get the page's height of the current display page....


3/7/2007 7:39:19 AM 24353 articles. 2 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 57
Get it on Google Play
Get it on Apple App Store

use javascript to receive window size, this function will display it with alert:

function alertSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  window.alert( 'Width = ' + myWidth );
  window.alert( 'Height = ' + myHeight );

3/7/2007 9:07:39 AM

function getBrowserWidthHeight() {
         var intH = 0;
         var intW = 0;
         if( typeof window.innerWidth  == 'number' ) {
            intH = window.innerHeight;
            intW = window.innerWidth;
         else if(document.documentElement &&
           (document.documentElement.clientWidth || document.documentElement.clientHeight) ) {
              intH = document.documentElement.clientHeight;
              intW = document.documentElement.clientWidth;
         else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
           intH = document.body.clientHeight;
           intW = document.body.clientWidth;
         return {width: parseInt(intW), height: parseInt(intH)};

 you would use it like
var bws = getBrowserWidthHeight();
alert(bws.width + "~" + bws.height);

Eric | Twitter epascarello | LinkedIn
3/7/2007 12:46:16 PM

Similar Artilces:

Page #'s out of sync with printed page #'s
I'm developing a several-hundred page datwindow report, and having a problem with page numbers online being different than page numbers on the printed copy. Typically, a 300-page online report will only print out as 150 pages. I know this is being caused by the difference in the number of lines that fit on a printed page vs. the number of lines that fit on a screen, but I don't know how to get them in sync. Does anyone know how to sync up the page numbers of a datawindow report with its printed copy? Thanks for any help... Use print preview. The preview window will assu...

changes made from one user's webpart's page, effects all user's
 I am just doing this offline right now in Visual Web Developer Express 2008I created the login inonce in the memberpage area, people can modify their webpart page. I created several users to test this out.  I loaded it in a browser.When I make changes as logged in user "A" .  Then logout and login as user "B", user "B,s" webpart page has been changed to user "A".This goes true for whomever I log in as.  It changes for everyone.Is there something specific I need to do in order to get everyone's changes to be unique for them...

Copy webparts from admin's page to regular user's page
I'm new to ASP.Net Webpart. I have a very basis question about how to copy webparts from admin's page to regular user's page. I understand that the admin could use the share mode to initially setup his webpart page. Then all other users would see the same webpart if they accesses to the same url. But let's say, if we have multiple departments, and each department has it own admin, and each department may have different webparts to be included in the page. One more requirememt that after the regular user accesses the page on the first time (after the department's admin has set the page up)...

How come FileFlash's home page doesn't get logged in Mozilla v1.7.5's history?
Is it me or is (not the links inside) home page not being recorded in Mozilla v1.7.5's history? I just noticed it. I looked at the source code, but didn't see anything interesting. I was using Windows XP Professional SP2 (all updates). Thank you in advance. :) -- Allah's Apostle said, "Once while a prophet amongst the prophets was taking a rest underneath a tree, an ant bit him. He, therefore, ordered that his luggage be taken away from underneath that tree and then ordered that the dwelling place of the ants should be set on fire. Allah...

How to set a Master Page's control's property through content page on a postback event?
Hi all, i m using a master page in my application. i have a panel on master page and a tab container with three tab panels on content page. i want to set/change  the visibility of the panel control when the tab is changed on the content page. By default the panel is invisible. To implement this i executed the following steps: 1. Set AutoPostBack of tacontainer to true 2. Wrote an event handler for ActiveTabIndexChanged event of the tab container 3 Wrote the following code on Tab changed event   if (TabContainerEmpPerformance.ActiveTabIndex == 1) { ...

Master page's "Load" event is later than content page's ?
Example:1. Add a label to master page, set its "text" attribute to nothing. 2. In master page's page load event, assign "hello" to label1.text3. In content page's page load event: Response.write (   ctype(master.FindControl("label1"),label).text   )it will be nothing. 4. In content page,  add a button named button1, in button1's click event, copy the upper sentence, it will write "hello". so , master page's load event it later than content page's ?  If I need the result of master page's load ev...

How do you manipulate textbox's width programmatically in Web Page's code-behind?
Hi guys, How do you manipulate width, height and bgColor of a textbox programmatically in aspx Web Page's code-behind form? I tried:    Textbox1.Width.ToString = 742px   And get “Expression is a value and therefore cannot be the target of an assignment” in reference to the underlined.   Drop me a line, thanks Henry Try the folowing: Textbox1.Width = 742Ryan OlshanASPInsider | Microsoft MVP, ASP.NEThttp://ryanolshan.comHow to ask a question...

Can I hide a user control's control from the hosting page's client script?
Okay, my previous question was not unswered and I guess you can't hide a control's panel with server code then show it with client code. Now this is what I try to do: on the hosting page's onload event, call a function to hide the user control's penal. Here is the deal: the user control was looped as many times as data required. So the penals will be name mypanel1, my panel2, etc... that is not even a problem if I know if the following is true: * Do all server codes finish running before the page get sent back to the client? Say the database gave me 5 penals, I can then determine how...

Open file in browser or application getting the page's name as the file's name
Hi, I'm am trying to get a file to open in either a browser or application depending on the mime type. I'am using the following code in the page load. protected void Page_Load(object sender, EventArgs e){ if (!IsPostBack)    { DocumentInfo document = (DocumentInfo)Session["View_Document"]; StreamFile(document.Document, document.DocumentName, document.FileType.MimeType); } } }private void StreamFile(byte[] fileData, string originalFileName, string mimeType) { try { Response.Clear(); Response.ContentType = mimeType; Response.AddHeader("Con...

How do I get the server-side page's processing/rendering time and display on page?
I notice a lot of pages (PHP I've seen) have at the bottom footer the page load time (like 0.52ms or so) along with the database query time perhaps.How do I get the page load time (the time the server took to compile / render the page) and display it on the bottom of the screen? hi,what you could do is declare a datetime variable say timestart initialize it in Page_init event, & in page unload try thistimespan ts = timestart - print its value.hope it helps.regards,satishKind Attn: If a reply to your post helped you, kindly mark it as Answered._____________________...

what's with ZDNET's home page?
Hello, Is anyone else seeing this? I am running Mozilla 1.4. When I load up, I get a broken-looking page. Same URL looks quite different in IE6. I look at the page source, and I see that they are serving up different pages to each browser! Can anyone confirm this, or is it just me? Thanks, pinner pinner blinn wrote: > Hello, > > Is anyone else seeing this? > > I am running Mozilla 1.4. When I load up, > I get a broken-looking page. Same URL looks quite different in > IE6. > > I look at...

How can I get out of my Mozilla's browser the Winamp browser and get back the Google's or Mozilla's browser.
Please I have got to my browser ( I don't know how.) the Winamp browser he behave like virus stick in.But he doesn't has uninstalation section so I can't do anything to get him away from Mozilla's file. I'm not happy of Winamp's behave its like advertisement against a customer's will. Please is there any way to get him away from Mozilla?Please send me exact direction I have tried many ways but he is deeply inside the systeme so when I install new Mozilla he is always here ready to pester me. Thank you for an answer. Richard ...

'Can't save web pages, Ctrl+S. 'Can save same pages from I.E
Name: Del Dyreson Email: Product: Firefox Summary: 'Can't save web pages, Ctrl+S. 'Can save same pages from I.E Comments: 'Can't save web pages, Ctrl+S. 'Can save same pages from I.E. I'm running Win2000Pro, Ver 5.0 (Build 2195, Service Pack 4). Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv: Gecko/20060508 Firefox/ ...

Execute UserControl's PageLoad before the Page's
 I have a Page that has a UserControl. How do I make the UserControl's PageLoad event execute before the PageLoad control of the calling page? Thanks.  I think this can't be done.But what you can do is make one public method in that control.And in page's page load before doing anything call that method. Regards,Mayank ParmarSoftware DeveloperClarion TechnologiesSEI CMMI Level 3 Company4th Floor, Great Eastern Plaza, Airport Road, Pune- 411 006,Maharashtra, India. Phone: +91 20 66020289Mobile: +91 9763210521 Hello ubelt, I am afraid you cannot let it done.  If t...

Web resources about - how to get page's width and page's height -

Resources last updated: 1/24/2016 1:40:53 AM