Wednesday, 16 October 2013

Hide Div tag By-Tanuj Kumar

 Hide Div tag


Javascript Code to Show or Hide Div:

This function can be done easily by java script program .

<html>
<head>

    <title>Javascript Program to Show/Hide Div Visibility</title>
  
    <script language="javascript" type="text/javascript">
   
        function showHideDiv() {
            var divstyle = new String();
            divstyle = document.getElementById("div1").style.visibility;
            if (divstyle.toLowerCase() == "visible" || divstyle == "") {
                document.getElementById("div1").style.visibility = "hidden";
            }
            else {
                document.getElementById("div1").style.visibility = "visible";
            }
        }
  
    </script>
</head>
<body>
    <div id="div1" class="divStyle">
        Show/Hide Div tag using java script.
    </div>
    <center>
        <input type="button" 
                value="show hide div" 
                onclick="showHideDiv()" />
    </center>
</body>
</html>

Posted By:Tanuj Kumar 
On:Shareyourconscience

Read More
Posted on 1:05:00 am
Categories:

Tuesday, 8 October 2013

Transaction in .net By:Tanuj Kumar

share your conscience

Transaction Example in .Net Program:

//first of all take button click event
button click()
   {
//create SqlConnection class object      
SqlConnection con = new SqlConnection("Connnection string");
      SqlTransaction transaction;
//open connection
       con.Open();
//begin transaction
      transaction = con.BeginTransaction();
      try 
      {
         new SqlCommand("INSERT INTO Transaction " +
            "(Text) VALUES ('Row1');", con, transaction)
            .ExecuteNonQuery();
         new SqlCommand("INSERT INTO Transaction " +
            "(Text) VALUES ('Row2');", con, transaction)
            .ExecuteNonQuery();
         new SqlCommand("INSERT INTO transaction2 VALUES " +
            "('Die', 'Die', 'Die');", con, transaction)
            .ExecuteNonQuery();
         transaction.Commit();
      } 
      catch (SqlException sqlError) 
      {
         transaction.Rollback();
      }
      con.Close();
   }



Posted By:Tanuj Kumar 
On:Shareyourconscience

Read More
Posted on 11:54:00 pm
Categories:

Tuesday, 1 October 2013

Calculate n^n using java script By:Tanuj Kumar

Share your conscience

Calculate n^n using java script.(Java script Program)


var a = parseInt(prompt("Enter your number"));
var b = a;
var i;
for (i = 0; i <= b; i++)
{
a = a * b;
}
a = a / (b * b);
alert("the number is: " + a);





Posted By:Tanuj Kumar 
On:Shareyourconscience
Read More
Posted on 1:16:00 am
Categories:

Find Prime No. Using Java Script By:Tanuj Kumar

Find Prime No. Using Java Scrip

Find Prime No. Using Java Script

var num =prompt("Enter a number");
parseInt(num);var i;var b=0; if(num==1)
{
alert("A prime number is a number which has only two factors, 1, and itself. But in the case of 1, there is only one factor: 1. So, 1 is not a prime number");
}
else{
for(i=1;i<=num;i++)
{
var result = num%i;
if(result==0)
{
b++;
} }
if(b<=2)
{
alert("Prime no.");
}
else
{
alert("Not Prime");
}
}

Posted By:Tanuj Kumar 
On:Shareyourconscience

Read More
Posted on 1:14:00 am
Categories:

Unhide all sheet in MS EXCEL 2010 Using Macro By:Tanuj Kumar

Unhide all sheet in MS EXCEL 2010 Using Macro

Unhide all sheets in MS Excel 2010 using Macros.

Goto view>>Macros>>view macros>>create
then copy paste the below code then save the sheet.

Dim all_ws As Worksheet
For Each all_ws In ActiveWorkbook.Worksheets
all_ws.Visible = xlSheetVisible
Next all_ws

confirm to save.
Now run the create Macros.




Posted By:Tanuj Kumar 
On:Shareyourconscience

Read More
Posted on 1:01:00 am
Categories: