Enter Keyword Hear for Search This Blog

Thursday, 31 March 2016

How to check number prime or not in java

primeno.java

class primeno
{
public static void main(String args[])
{
int no=17,flag=0;
int m=no/2;

for(int i=2;i<=m;i++)
{
if(no%i==0)
{
System.out.println("This Number is not Prime");
flag=1;
break;
}

}
if(flag==0)
{
System.out.println("This number is Prime");
}
}
}

Tuesday, 29 March 2016

How to drag and drop between two textbox

twobox.html



<html>
    <head>
        <title>Drag And Drop between two textbox</title>
        <script type="text/javascript">
            function handleDragDropEvent(oEvent) {
                var oTextbox = document.getElementById("txtara");
                oTextbox.value =oTextbox.value + oEvent.type + "\n";
            }
        </script>
    </head>
    <body>
        <P>Dragging the text from the left textbox to the right textbox.</p>
        <P>
        <input type="text" value="drag this text"/>
        <input type="text"
               ondragenter="handleDragDropEvent(event)"
               ondragover="handleDragDropEvent(event)"
                             />
        </p>
        <P><textarea rows="12" cols="23" readonly="readonly" id="txtara"></textarea></p>
    </body>
</html>

How to show drag and drop event in textarea using event.type in javascript

dragdrop1.html



<html>
    <head>
        <title>Show Event Drag And Drop</title>
        <script type="text/javascript">
            function handleDragDropEvent(oEvent)
            {
                var oTextbox = document.getElementById("txtara");
                oTextbox.value = oTextbox.value + oEvent.type + "\n";
            }
        </script>
    </head>
    <body>
        <P>This is a text</p>
        <input type="text"
               ondragenter="handleDragDropEvent(event)"
               ondragover="handleDragDropEvent(event)"
               /></p>

        <P><textarea rows="12" cols="23"  id="txtara"></textarea></p>
    </body>
</html>

Monday, 7 March 2016

How to download direct any file using php code

download.php

<?php

$getfile="https://www.demo.com/bollywood/videos/2.mp4";

header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.$getfile);
header('Content-Transfer-Encoding: binary');

$file = @ fopen($getfile, 'rb') or die("Techincal Error");    

fpassthru($file);
        
?>

Friday, 4 March 2016

How to create a clock window using moveBy in JavaScript

clock.html


<html>
<head><title> MoveBy</title>
</head>
<script>
var x=0;
var y=0;
function openwin()
{
mywin=window.open("","","width=50,height=50");
}
function closewin()
{
if(mywin)
{
mywin.close();
}
}

function movebywin()
{
if(x<600 && y==0)
{
x=x+200;
if(x==600)
{
y=y+100;
}
}
else if(x==600 && y<=300)
{
y=y+100;
if(y==300)
{
x=x-200;
}
}
else if( x<=600 && y==300)
{
x=x-200;
if(x==0)
{
y=y-100;
}
}
else if(x==0 && y<=300)
{
y=y-100;
if(y==0)
{
x=x+200;
}
}
mywin.moveTo(x,y);
mywin.focus();
}
</script>
<body>
<input type="button" value="Open window" onclick="openwin()">
<input type="button" value="Move" onclick="movebywin()">
<input type="button" value="Close" onclick="closewin()">
</body>
</html>

How to create window clock using move in JavaScript

clock.html


<html>
<head><title> MoveBy</title>
</head>
<script>
var x=0;
var y=0;
function openwin()
{
mywin=window.open("","","width=10,height=10");
}
function closewin()
{
if(mywin)
{
mywin.close();
}
}

function movebywin()
{
if(x<600 && y==0)
{
x=x+200;
if(x==600)
{
y=y+100;
}
}
else if(x==600 && y<=300)
{
y=y+100;
if(y==300)
{
x=x-200;
}
}
else if( x<=600 && y==300)
{
x=x-200;
if(x==0)
{
y=y-100;
}
}
else if(x==0 && y<=300)
{
y=y-100;
if(y==0)
{
x=x+200;
}
}
mywin.moveTo(x,y);
mywin.focus();
}
</script>
<body>
<input type="button" value="Open window" onclick="openwin()">
<input type="button" value="Move" onclick="movebywin()">
<input type="button" value="Close" onclick="closewin()">
</body>
</html>

Thursday, 25 February 2016

How to create clock wise window screen in javascript

clock.html


<html>
<head><title> MoveBy</title>
</head>
<script>
var x=0;
var y=0;
function openwin()
{
mywin=window.open("","","width=10,height=10");
}
function closewin()
{
if(mywin)
{
mywin.close();
}
}

function movebywin()
{
if(x<600 && y==0)
{
x=x+200;
if(x==600)
{
y=y+100;
}
}
else if(x==600 && y<=300)
{
y=y+100;
if(y==300)
{
x=x-200;
}
}
else if( x<=600 && y==300)
{
x=x-200;
if(x==0)
{
y=y-100;
}
}
else if(x==0 && y<=300)
{
y=y-100;
if(y==0)
{
x=x+200;
}
}
mywin.moveTo(x,y);
mywin.focus();
}
</script>
<body>
<input type="button" value="Open window" onclick="openwin()">
<input type="button" value="Move" onclick="movebywin()">
<input type="button" value="Close" onclick="closewin()">
</body>
</html>

Tuesday, 23 February 2016

How to create JavaScript simple program

1.html 


<script type="text/javascript" language="javascript">

      var num=3;

      switch (num)
     {
                    case 1: alert("One");
                                  break;
                    case 2: alert("Two");
                                  break;
                    case 3: alert("Three");
                                  break;
                    case 4: alert("Four");
                                  break;
                    case 5: alert("Five");
                                  break;
                       
                   default: alert("Select 1 to 5 Number");
     }       
</script>


                                Array


=>Def : Array is a collection of data
1. length

<script>
     var cars = ["Saab", "Volvo", "BMW"];
    cars.length;
</script>


2.Element

<div id="ele"> </div>

<script>
          var bike=["R15","Shine","Honda","Bajaj"];
          document.getElementById("ele").innerHTML=bike;
</script>

Method : 1.push()
                 2.pop()
                 3.shift()
                 4.unshift()
                 5.concat()
                 3.join()


Properties : 1.length()
                     2.prototype()
                     3.constructor()
               

=> Array in array
  
<script>
             var demo = new array();
                      demo[0] = new array();
                      demo[0][0]='A0';
                      demo[0][1]='B0';
                      demo[0][2]='C0';

                      demo[1] = new array();
                      demo[1][0]='A1';
                      demo[1][1]='B1';
                      demo[1][2]='C1';

                      demo[2] = new array();
                      demo[2][0]='A2';
                      demo[2][1]='B2';
                      demo[2][2]='C2';
       
                      document.write("A : "+demo[0][0]+"<br/>");
                      document.write("B : "+demo[0][1]+"<br/>");
</script>

Friday, 19 February 2016

How to create a simple form in html

form.html


<form action="form.html" method="post" enctype="multipart-form">
       <input type="file" name="logo" required>
       <br/><br/>
       <input type="text" name="fnm" placeholder="Enter First Name" required>
       <br/><br/>
       <input type="text" name="lnm" placeholder="Enter Last Name" required>
       <br/><br/>
       <input type="text" name="unm" placeholder="Enter User Name" required>
       <br/><br/>
       <input type="email" name="email" placeholder="Enter Email-Id" required>
       <br/><br/>
       <input type="password" name="pwd" placeholder="Enter Password" required>
       <br/><br/>
       <input type="password" name="rpwd" placeholder="Enter Re-Password" required>
       <br/><br/>

       <input type="submit" value="Submit">
</form>

Monday, 15 February 2016

Select Query in php

  1.  How to compare your email and pwd with your database in login table
       - select * from login where email="$email" and pwd="$pwd"
       - select email,pwd from login where email="$email" and pwd="$pwd" 

     2.  How to select table in column
      
       - select * from table_name
       - select col1,col2 from table_name

     3. How to used select query with order by,limit and ascending order
     
      - select * from table1 order by 'table1','col1' ASC 

      - select * from table1 order by 'table1','col1' DESC

      - select * from table1 order by 'table1','col1' ASC LIMIT 0,30

How to create a Captcha code in php


ex1.php


<?php 

    $a = "abcdefghijklmnopqrstuvwxyz0123456789                ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    $str = " ";

    for ($i=1; $i <=6 ; $i++)
    { 
$str = $str.substr($a, rand(0,strlen($a)-1),1);
    }

echo $str;

?>


Featured post

what is ajax?how to create ajax with php code

Ajax Introduction -  એજેક્સ નો ઉપીયોગ કરી ને તમે પેજ લોડ કાર્ય વિના બધી માહિતી મેળવી શકો.એજેક્સ થી તમે કોઈ પણ ડેટા ઝડપ થી મેળવી શકો છો...