Disable RightClick Mouse and Disable Print Screen Key…Using JavaScript

ImageImage

 How To Block Print Screen As well As Mouse functionalities With Java Script

<html>
<head>

 <script language=”Javascript1.2″>
am = “This function is disabled!”;
bV  = parseInt(navigator.appVersion)
bNS = navigator.appName==”Netscape”
bIE = navigator.appName==”Microsoft Internet Explorer”
function check(e) {
   if (bNS && e.which > 1){
      alert(am)
      return false
   } else if (bIE && (event.button >1)) {
     alert(am)
     return false;
   }
}
document.onmousedown = check;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (bNS && bV<5) window.onmousedown = check;
</script>
</head>
<!–what i mention in body tag that the way to impliment inline java script –>
<body onload=setInterval(“window.clipboardData.setData(‘text’,”)”,2) oncontextmenu=”return false” onselectstart=”return false” >
This Document is Protected with RightClick & left Click &Print Screen  with Alerts!!!!!!!!!!!!!!!
</body>
</html>

With Regards ,

K.RAJA SEKHAR REDDY (Software Developer)

Posted in JavaScrpit | Tagged | 3 Comments

Restrict Copy Paste in Webpages with java Script

Image

Easy To Implement Try  This

<html>
<head>
<script type=”text/javascript”>
function start(){
block = setInterval(“window.clipboardData.setData(‘text’,”)”,20);
}
function stop(){
clearInterval(block);
}
</script>
</head>

<body onload=”start();”>
YOU TRY TO COPY AND PASTE THIS SCREEN, AND ALL THE ACTIVE SCREENS
<input type=”button” onclick=”stop();” value=”stop blocking copy/paste!”>

</body>
</html>

With Regard’s

K.RAJA SEKHAR REDDY(RAJ9992)

Software Developer

Posted in JavaScrpit | Tagged | Leave a comment

JHTML (Java within Hypertext Markup Language)

JHTML (Java within Hypertext Markup Language) is a standard for including a Java program as part of a Web page (a page written using the Hypertext Markup Language, or HTML). A Web site developer can write a small program using the Java programming language and insert the program within a Web page. When a user requests the page, the Web site server, observing a request for a file with the .jhtml suffix, passes the code to a special Java program designed to handle JHML. This program, called the PageCompileServlet, calls the Java compiler , which quickly compiles the code. (If the code has previously been compiled by an earlier page request, this step is unnecessary.) The code is then executed, typically modifying the contents of the Web page in some way before it is sent to the requestor.

JHTML is comparable to Microsoft’s Active Server Page and to PHP in that all are approaches to modifying a Web page at the server before it is sent rather than at the client(the user’s Web browser) with JavaScript. To access a database from the Web page, the Java code might use the Java Database Connectivity (JDBC) interface.

JHTML requires installing a Java compiler on the Web server. JHTML is part of JavaSoft’s Java WebServer Application Program Interface.

Posted in Uncategorized | Leave a comment

How to Use Jstl(JSP Standard Tag Library) Sql tag

 

Using   Tag Library To Retrieve Data From The Data Base   

  Before Implementing Import Jstl.jar                            

 

<%@ page import=”java.io.*,java.util.*,java.sql.*”%>
<%@ page import=”javax.servlet.http.*,javax.servlet.*” %>
<%@ taglib uri=”http://java.sun.com/jsp/jstl/core&#8221; prefix=”c”%>
<%@ taglib uri=”http://java.sun.com/jsp/jstl/sql&#8221; prefix=”sql”%>
 
<html>
<head>
<title>Retrieving Using Sql Tag </title>
</head>
<body>
 
<sql:setDataSource  driver=”com.mysql.jdbc.Driver” url=”jdbc:mysql://localhost:3306/LOGIN” user=”root”  password=”root”   />

<sql:query var=”result”  >
   SELECT * from register;
</sql:query>
 
<table border=”1″ width=”100%”>
<tr>
   <th>UserId</th>
   <th>Username</th>
   <th>Phoneno</th>
   <th>Email</th>
</tr>
<c:forEach var=”row” items=”${result.rows}”  >
<tr>
   <td><c:out value=”${row.userid}”/></td>
   <td><c:out value=”${row.username}”/></td>
   <td><c:out value=”${row.phoneno}”/></td>
   <td><c:out value=”${row.email}”/></td>
</tr>
</c:forEach>
</table>
 
</body>
</html>

 

 

 

Thanks & Regards

K.RAJ SEKHAR REDDY

(software Developer )

 

 

Posted in Uncategorized | Leave a comment

disable back button functionality With JavaScript

                                                                       Disable Back Button Functionality

<HTML>
<HEAD>
<TITLE>Disable Back Button in Browser</TITLE>
<STYLE>body,input{font-family:Calibri,Arial}</STYLE>
<script type=”text/javascript”>
    function clickLink() {
        document.getElementById(“link”).click();
    }
</script>
<body onload=”clickLink()”>
<a id=”link” href=”#” />
<H2>BackButtonRestrict</H2>
</BODY>
</HTML>

With Regards

RAJ9992

Posted in Uncategorized | Tagged | Leave a comment

EmailValidation

Image<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”&gt;
<html>
 <head>
  <title> New Document </title>
  <meta name=”Generator” content=”EditPlus”>
  <meta name=”Author” content=””>
  <meta name=”Keywords” content=””>
  <meta name=”Description” content=””>
 </head>
<script>
function ValidateEmail(inputText)  
{  
var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;  
if(inputText.value.match(mailformat))  
{  
document.form1.text1.focus();  
return true;  
}  
else  
{  
alert(“You have entered an invalid email address!”);  
document.form1.text1.focus();  
return false;  
}  
}
</script>
<body>
<form name=”form1″ action=”#”>   
<input type=’text’ name=’text1’/>
<input type=”submit” name=”submit” value=”Submit” onclick=”ValidateEmail(document.form1.text1)”/></li>  
</form>  
</body>
</html>

 

 

Explanation

/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/

Character         Description
/ .. /                  All regular expressions start and end with forward slashes.
^                      Matches the beginning of the string or line.
\w+                  Matches one or more word characters including the underscore. Equivalent to [A-Za-z0-9_].
[\.-]                  \ Indicates that the next character is special and not to be interpreted literally.
.-                      matches character . or -.
?                       Matches the previous character 0 or 1 time. Here previous character is [.-].
\w+                  Matches 1 or more word characters including the underscore. Equivalent to [A-Za-z0-9_].
*                      Matches the previous character 0 or more times.
([.-]?\w+)*        Matches 0 or more occurrences of [.-]?\w+.
\w+([.-]?\w+)*  The sub-expression \w+([.-]?\w+)* is used to match the username in the email. It begins with at least one or more word characters including the underscore, equivalent to [A-Za-z0-9_]. , followed by . or – and . or – must follow by a word character (A-Za-z0-9_).
@                       It matches only @ character.
\w+([.-]?\w+)*     It matches the domain name with the same pattern of user name described above..
\.\w{2,3}             It matches a . followed by two or three word characters, e.g., .edu, .org, .com, .uk, .us, .co etc.
+                        The + sign specifies that the above sub-expression shall occur one or more times, e.g., .com, .co.us, .edu.uk       etc.
$                       Matches the end of the string or line.

 

With Regards

RAJ9992

 

Posted in Uncategorized | Tagged | Leave a comment

javascript to get value of File in Html with in the Page

Input Type File

<html>
<head>
<title> New Document </title>
<meta name=”Generator” content=”EditPlus”>
<meta name=”Author” content=””>
<meta name=”Keywords” content=””>
<meta name=”Description” content=””>
</head>
<script >
function Check()
{
var name=document.getElementById(‘INPUT’).value;
alert(name);
document.getElementById(‘OUTPUT’).innerHTML=name;
}
</script>
<body>
<input type=”file”  id=’INPUT’  value=””  >
<input type=”button”  value=”Check”  onclick=”Check()” >
<div id=’OUTPUT’></div>
</body>
</html>

This is just to check the value returned from different Browsers ,We call This as Browser Compatibility  issues ………..

With Regards

K.RAJA SEKHAR REDDY

Software Engineer

Image | Posted on by | Leave a comment

Disable Back Button in Browser With JavaScript

Image

Disable Back Button in Browser With JavaScript

<HTML>
<HEAD>
<TITLE>Disable Back Button in Browser</TITLE>
<STYLE>body,input{font-family:Calibri,Arial}</STYLE>
<script type=”text/javascript”>window.history.forward();function noBack(){window.history.forward();}</script>
</HEAD>
<BODY onload=”noBack();” onpageshow=”if (event.persisted) noBack();” onunload=””>
<H2>BackButtonRestrict</H2>

<p>This page contains the code to avoid Back button.
</p>
<p>Click here to Goto <a href=”#”>NoBack Page</a>
</p>
</BODY>

</HTML>

Posted in JavaScrpit | Tagged | Leave a comment

Constructor and Destructor of Java

Constructor and Destructor of Java

Intriduction of constructor.
Constructor and destructor are two important concepts of object oriented programming language. Constructor is nothing but a special type of member function that invokes automatically when the object is created of the particular class. In Java memory allocation is possible using new operator.
Example
        // instantiate an object of the class cat
        Home myhome  = new Home();

Here Home is class name and myhome is object name. In this particular statement, the new operator is used to allocate dynamic memory from the heap, and also as the constructor to construct the object in that memory space.The difference between class and structure is class member creates in heap memory and structure member is creates in stack memory. For that, class member access is more efficient than structure member access.  The address of the memory containing the object is returned and assigned to the reference variable named myhome If the memory cannot be allocated due to some reason, an exception will be thrown. In JAVA you do not define a constructor when you define a new class, a default constructor that takes no parameters is defined on your behalf.
You can also define your own constructor with no argument needed. Defining a constructor is similar to defining a method, but must have the same name as the class, do not have a return type and must not have return statements. There are three types of Constructor in JAVA

1)Default constructor
Constructor with no argument is called default constructor.
Example:
     Class hello()

{

   Hello()

{

 System.out.println(“I am hello constructor”);

}

}

2) Parameterized constructor
Constructor which takes parameter during the time of invocation is called parameterized constructor.
Example
Class unit
{
 Private int n;
 unit(int var)   //Parameterized constructor.
{
  n=var;
}
}
3)Copy constructor 
Takes object as a argument. It copies one object into another object.
Example:
Class unit
{
  Int n;
 unit(unit a)   //Copy constructor.
{
  this.n=this.a;
}
}

3)Copy constructor 
Takes object as a argument. It copies one object into another object.
Example:
Class unit
{
  Int n;
 unit(unit a)   //Copy constructor.
{
  this.n=this.a;
}
}

Features of constructor:-
1) Constructor need not call, it calls automatically when object creates.
2) Constructor name and class name must be same.
3) Generally constructor is declared as public mode.
4) Constructor is used to initialize object.
5) Constructor can be overloaded.
6) Constructor may be virtual.
7) constructor of one class can call constructor of other class using super keyword.
Destructor and finalize() method 
A destructor is a special method typically used to perform cleanup after an object is no longer needed by the program. C++ supports destructors, but JAVA does not support destructors.
JAVA supports another mechanism for returning memory to the operating system when it is no longer needed by an object.

Sometimes an object will need to perform some action when it is destroyed. For example,

if an object is holding some non-Java resource such as a file handle or window character

font, then you might want to make sure these resources are freed before an object is

destroyed. To handle such situations, Java provides a mechanism called finalization. By

using finalization, you can define specific actions that will occur when an object is just

about to be reclaimed by the garbage collector.

Example of  finalize() method.
public class Thing {

public static int number_of_things = 0;
public String what;

public Thing (String what) {
        this.what = what;
        number_of_things++;
        }

protected void finalize () {     //Destructor function
        number_of_things–;
        }

}

Garbage Collection
Since objects are dynamically allocated by using the new operator, you might be
wondering how such objects are destroyed and their memory released for later
reallocation. In some languages, such as C++, dynamically allocated objects must be
manually released by use of a delete operator. Java takes a different approach; it handles
deallocation for you automatically. The technique that accomplishes this is called garbage
collection. It works like this: when no references to an object exist, that object is assumed
to be no longer needed, and the memory occupied by the object can be reclaimed. There is
no explicit need to destroy objects as in C++. Garbage collection only occurs sporadically
(if at all) during the execution of your program. It will not occur simply because one or more
objects exist that are no longer used. Furthermore, different Java run-time implementations
will take varying approaches to garbage collection, but for the most part, you should not
have to think about it while writing your programs.

 

Posted in Java Concepts | Leave a comment