Saturday, December 21, 2013

PHP Incrementing characters

PHP provides an easy way to increment characters.

$var='a';

$var++;
echo $var;    // outputs b

If we increment a character by five positions,then increment has to be done five times.
$var++;
$var++;
$var++;
$var++;
$var++;

$var=$var+5;   // this does not increments the character by five positions

Friday, July 19, 2013

Placing two tables Horizontally in a Html page

 <html>
<head>
<style>
.tableHorizontal
{display:inline-block;
width:50%;
float: left;}
</style>
</head>

<body>
<table class="tableHorizontal">
<tr style="color: green;"><td>table 1   first row</td></tr>
<tr style="color:green;"><td>table 1  Second row</td></tr>
<tr style="color: green;"><td>table 1  Third row</td></tr>
<tr style="color: green;"><td>table 1  Fourth row </td></tr>
<table>

<table  class="tableHorizontal">
<tr style="color: red;"><td>table 2  first row</td></tr>
<tr style="color: red;"><td>table 2  Second row</td></tr>
<tr style="color: red;"><td>table 2  Third row</td></tr>
<tr style="color: red;"><td>table 2  Fourth row</td></tr>
<table>
</body>
</html>

The Output of  the above html page will look like as below :  

table 1 first row
table 1 Second row
table 1 Third row
table 1 Fourth row
table 2 first row
table 2 Second row
table 2 Third row
table 2 Fourth row


Explanation:
  • Two required tables which are to be placed horizontally are created with same class name  tableHorizontal
                                                  <table  class="tableHorizontal">
  •  css is applied for the class name  tableHorizontal  
                                   .tableHorizontal
                                      {
                            display:inline-block; 
                               width:50%;
                            float: left;
                                     }
 

Sunday, April 7, 2013

HTML buttons animation on mouse hover and on mouse out

 <style>
       .btn1
         {
             color: #b85c5c;  //this sets the font color of the text in the buttons
            
         }
       .btn1hov
       {
           color:#2d579a;      //this sets the font color of the text in the buttons
           border: 1px solid navy;   //this sets the border color of the  buttons
       }
         input[type=button].btn2
         {
            
             color: #b85c5c;
            
         }
         .btn2hov
         {
              color:#2d579a;
              border: 1px solid navy;
         }
</style>


Place the above code in header section of a html webpage

        <input type="button" value="User Login" title="Click for Normal User Login Page"  class="btn1" onmouseover="this.className='btn1hov'" onmouseout="this.className='btn1'" onclick="location.href='login.jsp'" >
        <input type="button" value="Admin Login" title="Click for Admin Login Page" class="btn2" onmouseover="this.className='btn2hov'" onmouseout="this.className='btn2'" onclick="location.href='adminlogin.jsp'">


Place the above code in body section of same html page.
The buttons take the class btn1,btn2 initially, i.e the font on the buttons will be in color  #b85c5c.

When the mouse is hovered on the buttons,the buttons takes the classes btn1hov,btn2hov.This is possible by using event onmouseover.

After the mouse hover is out from the buttons,they again takes the classes btn1,btn2.This is possible by using event onmouseout


We can watch the live demo ,by visitng the link http://jsfiddle.net/tq7vm/

Monday, March 18, 2013

Jquery Ajax Function Code

  $.ajax({
  type: "POST",
  url: "Bookresponse.jsp",
  data: { category:document.book.category.value,
Title:document.book.Title.value,
Author:document.book.Author.value,
Publication:document.book.Publication.value,
Edition:document.book.Edition.value,
Noofcopies:document.book.Noofcopies.value,
Volume:document.book.Volume.value,
Datepur:document.book.Datepur.value,
Price:document.book.Price.value
}
  })


Place the above function inside   $('#exm').on('submit', function(e) {    and      }.

exm is the id of the form which is to be submitted and on clicking on submit, data is submitted to Bookresponse.jsp file.
Each input element data is passed through by using form name and element name.Book is the form name and category is the input element name.

In Bookresponse.jsp file,each value is retrieved .For example,String str=request.getParameter("category");