Popular Posts

Wednesday, December 7, 2011

Find Resultset Size in JAVA

rs.lastindex();
int totalRow=rs.getRow();
System.out.println("Number of rows in resultset is "+totalRow);

Wednesday, November 9, 2011

Change row Color on mouse click or mouse over through JS

<html>
    <head>
        <Title>Table Assignment</Title>
        <style type="text/css">
                        body {
                            background-color: #728FCE;
                            text-align: center;}
                        h1 {text-align: center;
                            text-decoration: underline;
                            text-transform: uppercase;
                            color:white;}
                        tr{background-color: #ADA96E}
                        th{background-color:#A0CFEC;
                        color:#254117;}
                        .mouseout { background-color:#ADA96E }
                        .mouseover { background-color:#F62817 }
        </style>
    </head>
    <Body onkeydown="keyPressed(event)">
        <form id="form1">
            <h1>Select the Column</h1>
                <table border="1" align="center">
                <tr style="background:#95B9C7">
                    <th>S.No.</th>
                    <th>First Name</th>
                    <th>Last Name</th>
                    <th>Department</th>
                    <th>Salary</th>
                </tr>
                <tr id="1" onMouseOver="this.className='mouseover'" onMouseOut="this.className='mouseout'" onClick="getId(this.id)">
                    <td>1</td>
                    <td>Ram</td>
                    <td>Kumar</td>
                    <td>IT</td>
                    <td>15000</td>
                </tr>
                <tr id="2" onMouseOver="this.className='mouseover'" onMouseOut="this.className='mouseout'" onClick="getId(this.id)">
                    <td>2</td>
                    <td>Ajay</td>
                    <td>Yadav</td>
                    <td>Accountancy</td>
                    <td>25000</td>
                </tr>
                <tr id="3" onMouseOver="this.className='mouseover'" onMouseOut="this.className='mouseout'" onClick="getId(this.id)">
                    <td>3</td>
                    <td>Vijay</td>
                    <td>Yadav</td>
                    <td>Accountancy</td>
                    <td>55000</td>
                </tr>
                </table>
               
        </form>
       
    </body>
</html>

Mouse over effect in table through JS in HTML

<html>
    <head>
        <Title>Table Assignment</Title>
        <style type="text/css">
            body {
                background-color: #728FCE;
                text-align: center;
                }
            h1 {
                text-align: center;
                text-decoration: underline;
                text-transform: uppercase;
                color:white;}
            tr{background-color: #ADA96E}
           
            th{background-color:    #A0CFEC
                color:#254117;}
            .mouseout { background-color:#ADA96E }
            .mouseover { background-color:#F62817 }
            </style>
    </head>
    <Body>
        <form id="form1">
            <h1>Select the Column</h1>
                <table border="1" align="center">
                <tr style="background:#95B9C7">
                    <th>S.No.</th>
                    <th>First Name</th>
                    <th>Last Name</th>
                    <th>Department</th>
                    <th>Salary</th>
                </tr>
                <tr onMouseOver="this.className='mouseover'" onMouseOut="this.className='mouseout'">
                    <td>1</td>
                    <td>Ram</td>
                    <td>Kumar</td>
                    <td>IT</td>
                    <td>15000</td>
                </tr>
                <tr onMouseOver="this.className='mouseover'" onMouseOut="this.className='mouseout'">
                    <td>1</td>
                    <td>Ram</td>
                    <td>Kumar</td>
                    <td>IT</td>
                    <td>15000</td>
                </tr>
                <tr onMouseOver="this.className='mouseover'" onMouseOut="this.className='mouseout'">
                    <td>1</td>
                    <td>Ram</td>
                    <td>Kumar</td>
                    <td>IT</td>
                    <td>15000</td>
                </tr>
                <tr onMouseOver="this.className='mouseover'" onMouseOut="this.className='mouseout'">
                    <td>1</td>
                    <td>Ram</td>
                    <td>Kumar</td>
                    <td>IT</td>
                    <td>15000</td>
                </tr>
                <tr onMouseOver="this.className='mouseover'" onMouseOut="this.className='mouseout'">
                    <td>1</td>
                    <td>Ram</td>
                    <td>Kumar</td>
                    <td>IT</td>
                    <td>15000</td>
                </tr>
                <tr onMouseOver="this.className='mouseover'" onMouseOut="this.className='mouseout'">
                    <td>2</td>
                    <td>Ajay</td>
                    <td>Yadav</td>
                    <td>Accountancy</td>
                    <td>25000</td>
                </tr>
                </table>
               
        </form>
       
    </body>
</html>

Thursday, December 9, 2010

X to the Power Y

class Power
{
    public static void main(String args[])
    {
        int n1,n2,i,power=1;
        n1=(int)(Math.random()*10);
        n2=(int)(Math.random()*10);
       
        System.out.println("First generated no. is="+n1);
        System.out.println("Second generated no. is="+n2);
       
        for(i=1;i<n2;n2++)
        {
            power*=n1;
            System.out.println("Power of number is:"+power);
        }
           
    }
}

Tuesday, October 19, 2010

OOPs programme

class Gcd
{
 public static void main(String args[])
 {
 
  int n1=(int)(Math.random()*100);
  int n2=(int)(Math.random()*100);
  System.out.println("First generated no. is"+n1);
  System.out.println("Second generated no. is"+n2);
  int max,min,i;
  if(n1>n2)
   {
     max=n1;
     min=n2;
   } 
  else
  {
   max=n2;
   min=n1;
  }
  System.out.println("Max is ="+max+" Min is ="+min);
 
  one: for(i=min;i>=1;i--)
  {
    if(max%i==0)
    {
     if(min%i==0)
     System.out.println("Output is "+i);
     else
     continue one;
   
    }
    if(max%i>0)
   
   
    System.out.println("GCD of no is =1");
   
  }
 } 
}