Tuesday 16 October 2012

To write a complete HTML structure in a new window


      function ShowDatePopUp()
        {   
         alert("hello");
         newwindow= window.open('','name','location=1,status=1,scrollbars=1,height=300,width=300');
         newwindow.moveTo(0, 0);
         newwindow.document.write('<html><head><title>');
         newwindow.document.write('Date Window');
         newwindow.document.write('</title></head>');
         newwindow.document.write('<BODY><form>');
      
        newwindow.document.write('<label for='TxtDate'>Enter Date </label>');
        newwindow.document.write('<input type='text' id='DateId' name='TxtDate'/>');

        newwindow.document.write('<input type='submit' value='Submit' class='SubmitButton'/>');
         newwindow.document.write('</form></BODY></html>');
         newwindow.document.close();
        
        
        }
         
         
         
      function ShowDateRangePopUp()
        {{   
         alert("hello");
         newwindow= window.open('','name','location=1,status=1,scrollbars=1,height=300,width=300');
         newwindow.moveTo(0, 0);
         newwindow.document.write('<html><head><title>');
         newwindow.document.write('Date Window');
         newwindow.document.write('</title></head>');
         newwindow.document.write('<BODY><form>');
      
        newwindow.document.write('<label for='TxtDate'>Enter Date </label>');
        newwindow.document.write('<input type='text' id='DateId' name='TxtDate'/>');

        newwindow.document.write('<input type='submit' value='Submit' class='SubmitButton'/>');
         newwindow.document.write('</form></BODY></html>');
         newwindow.document.close();
        
        
        }}

Friday 12 October 2012

Empty cells in a table

One day i worked on a table that fetches some record from database.But the empty cells were coming without border like that:(in internet explorer)

actually the table tag is like that

<table border="1">

To troubleshoot problem my TL suggested to include attribute/values for table tag as
rules="all" frame="box"

<table border="1" rules="all" frame="box">

my problem was solved (:)

Rules attribute of table tag--he rules attribute allows you to set borders (also called rules, surprise, surprise!) inside the table at the boundaries between cells
//Display only the borders between the rows:

<table rules="rows">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>

Table with rules="rows":
MonthSavings
January$100

//Display only the borders between the coloumns:

<table rules="cols">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>

Table with rules="cols":
MonthSavings
January$100

<table rules="all">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
</body>
</html>

Table with rules="all":
MonthSavings
January$100

frame="box "Display only the outside borders of a table:

Note: to encounter the above problem either give

<table border="1" rules="all" frame="box">

or
<table border="1"  frame="box">


 

Monday 1 October 2012

Tp calculate size of element

count = 0;
           
$("#SelectClientForExport option").each(function ( )
{
count++;
});
alert(count);


or either use

alert( $("#SelectClientForExport option").size());