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>

Featured post

what is ajax?how to create ajax with php code

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