September 2011 | Coding Cluster - using asp.net, c#, mvc 4, iphone, php, ios, javascript, in asp.net mvc 3 & more
 

Get Screen Resolution Using Javascript

Saturday

Find out and display a user's screen resolution with javascript.
In javascript, the screen.width and screen.height properties contain the size a visitor's monitor is set to.

This can be useful if you have a page designed for a screen resolution that is higher than some viewers may have available

The following javascript function  is used to get your system screen resolution.
<head>
 
<title>Get Screen Resolution</title>

<script type="text/javascript" language="javascript">
function scrResolution(){
        
var width=screen.width;
        var 
height screen.height;
        document.getElementById("txt_scrWidth").value=width;        document.getElementById("txt_scrHeight").value=height;
}
</script>
</head>
<body onload="scrResolution();">

  <table width="200" border="0">
     <tr>
       <td>  
 Width :
<input name="txt_scrWidth" type="text" id="txt_scrWidth" size="5" />
      </td>
     
</tr>
     
<tr>
       
<td>
           Height :
  
 <input name="txt_scrHeight" type="text" id="txt_scrHeight" size="5" />
       </
td>
     
</tr>
    
</table>
</body>
</html>
Your Screen resolution
     Width :px
     Height :px         


Get gmail contacts using C#

Wednesday

Import gmail contactlist using C#:

For getting started we need to download the following Google dll files and put these 3 dlls in BIN folder of your application.

1. Google.GData.Client
2. Google.GData.Contacts
3. Google.GData.Extensions

Then create an aspx file with two text boxes,one list box and a submit button (View screen shot)

Finally give your gmail user name and password to corresponding input boxes. Then click Get Contacts you will see all your gmail contacts list in Contacts box

                                       

Click here  for full code download

Div height not working in IE

Saturday

Div height is different in IE:


            In one of my client project (In ruby) I need a slider control for change the light's intensity The intensity range from 0 to 100.But don't allow the user to give intensity bellow 50.This means prevent the user to move the slider bellow 50.

           So I create two div elements,the first div contains the value 0...50 and its height is 4px(slider height) with green static background which means the user can't move the slider up to 50(a small trick!).The second div contains the original slider control and its value from 50...100.See the blow code(As per client requirement)


<table cellpadding="0" cellspacing="0" border="0" >
     <tr>
        <td style="vertical-align: bottom; padding-bottom: 1px;">
              <div style="font-size: 10px;">0</div>
               <div id="divDummySlider" class="dummySlider">&nbsp;</div>
          </td>
           <td>
                <div id="divSlider"></div>
            </td>
       </tr>
   </table>

With the following css

          .dummySlider
           {
                background-color: green;
                height: 4px;
                width: 50px;
           }


The above code work fine with all major browsers except IE. In IE the "divDummySlider" height is different from other browsers.See the image below...  


Before resolve div height in IE


After that I found the following solution to fix div height problem in IE .Look at the  dummy slider height is mingled with original slider control height (See the image below...)   

Div height after resolved  in IE 


                        
Solution:             
          .dummySlider
           {
                background-color: green;
                height: 4px;
                width: 50px;
                overflow:hidden; 
           }


                Just add "overflow:hidden;" property to the "divDummySlider" style.And finally I get relief from this problem.(Hope you also)  

 
 
 

RECENT POSTS

Boost

 
Blogger Widgets