Tuesday, October 28, 2008

Simple Javascript Clock

<html>

<head>

<title>A Simple Page</title>

<script language="JavaScript">

<!--

function gettime() {

    
var date=  new Date();

    
var hr = date.getHours();

    
var m = date.getMinutes();

    
var s = date.getSeconds();

    
var ampm= "AM";

    
if (hr > 11)

    
{

        
ampm= "PM"

    
}

    
if (hr > 12)

    
{

        
hr -= 12

    
}

    
if(m < 10)

    
{

        
m =  "0" + m

    
}

    
if(s < 10)

    
{

        
s =  "0" + s

    
}

    
document.clockform.clock.value = hr +  ":" + m + ":" + s + " " +ampm;

    
setTimeout( "gettime()",100)

}

//  -->

</script>

</head>

<body onload="gettime()">

<form name="clockform">

<input type="text" name="clock">

</form>

</body>

</html>



Try it online before use

Simple Javascript Clock

<html>

<head>

<title>A Simple Page</title>

<script language="JavaScript">

<!--

function gettime() {

    
var date=  new Date();

    
var hr = date.getHours();

    
var m = date.getMinutes();

    
var s = date.getSeconds();

    
var ampm= "AM";

    
if (hr > 11)

    
{

        
ampm= "PM"

    
}

    
if (hr > 12)

    
{

        
hr -= 12

    
}

    
if(m < 10)

    
{

        
m =  "0" + m

    
}

    
if(s < 10)

    
{

        
s =  "0" + s

    
}

    
document.clockform.clock.value = hr +  ":" + m + ":" + s + " " +ampm;

    
setTimeout( "gettime()",100)

}

//  -->

</script>

</head>

<body onload="gettime()">

<form name="clockform">

<input type="text" name="clock">

</form>

</body>

</html>


Test online before use

Monday, October 6, 2008

Data leaks rank high on the list of IT security concerns

According to a study conducted by Trend Micro, a company that specializes in providing flexible and customizable Internet security solutions, data leaks are rapidly becoming a security threat similar to that of viruses and malware. The study was conducted on 1,600 corporate PC users and it shows that the most affected countries are the UK, US, Germany and Japan.

According to the study, computer viruses came in as the number one ranked security threat, while the loss of private, confidential data came in at number two, surpassing phishing attacks, spyware and spam. Most of the times an insider is responsible for the data leak; that person is either careless of the information or is simply unaware that sensitive data is being handled. But whenever a company loses such data, it results in bad media coverage, fines, litigation, and last but not least the corporate brand being irrevocably damaged.

Rik Ferguson, solutions architect with Trend Micro comments: "The survey highlights some key challenges, including user education, inadequate security policies and the broad brush access rights typical in many enterprises today. All too often employees simply do not know which information is confidential, within the remit of public domain or of restricted distribution. Even if the regulations were clear, employees are often unaware of the corporate policy around such information."

Out of the 1,600 people surveyed, only 6% admitted to having lost private corporate information. It seems that the Japanese are the least inclined to avow data leaking.

In regard to computer savvy, the Americans take the lead position with 74% of respondents claiming they are well aware which type of info is confidential and proprietary. On a personal note, the US respondents may be aware that the data is confidential, but about 12,000 laptops are lost in airports each week (most of the times the data on said laptops is not encrypted). The Japanese come last with only 40%, but the study shows that employees in large corporations are more aware of confidential data as opposed to those working in smaller companies.

The worrying part is that only 54% of companies have thought ahead and have come up with a data loss prevention policy; the remaining 46% of companies that took part in the study have no such preventive measure. Generally speaking, large corporations are more inclined to implement such a policy, as opposed to their smaller counterparts. Also, the study showed that UK based companies are the least preoccupied in coming up with and implementing such a security measure.

While at work, the study revealed that different nationalities have different surfing habits. The British for example are more inclined to do a spot of shopping or visit a social networking site; the Americans will watch or listen to streaming media; the Japanese will download .exe files. Statistics about the Germans were not in the study - presumably they just got on with their work.

Thursday, October 2, 2008

Wednesday, October 1, 2008

'onContextMenu' Example

 

    


<html>

<head>

<script language="JavaScript">

    
function function2() {

        
alert("This image is copyrighted") 

    
}

</script>

</head>

<body oncontextmenu="function2()">

    
<p>Right click in the image.</p>

    
<img oncontextmenu="function2()" 

         
src="http://www.navioo.com/style/logo.png" 

         
alt="www.navioo.com" 

         
width="99" 

         
height="76">

</body>

</html>

If you want to disable the context menu, 

add the following code to the <body>:

oncontextmenu="function2(); return false;"

      


      



Try it online

Friday, September 26, 2008

Keyczar, a Reliable Open Source Cryptography Tool

Cryptography has never been easier to handle
A Google-MIT team has just launched an open source encryption toolkit that can be used with both symmetric and asymmetric keys. In the first case, the same key helps both the encryption and decryption of a program. In order to decrypt the message, programmers must know what the secret key is. Decryption is usually made by a different user than the one who encrypts a program, so sharing the secret key must be made perfectly secure. Asymmetric keys are used to ensure a safe transport of the message from the sending programmer to the receiving one.

The features brought by the cryptography tool, namely Keyczar, make it of real help to coders in distress. One of these features is a simple Application Programming Interface that enables some applications use the services of another. Also, Keyczar brings a key rotation and versioning, which enables programmers with the possibility of assigning numbers to and keeping track of the latest versions of an application.

Safe default algorithms, modes (settings that enable user inputs to have more functions, depending on the settings provided by the coder) and key lengths are other features of the new Google open source product. Initialization vectors, used to produce different streams, by using the same encryption key, are automatically generated to give users a helpful hand. Ciphertext signatures are automatically generated, as well.

The tool can be used by both Java and Python programmers, while C fans have to wait a while, until the version to allow C implementation is developed. The team promises that this specific language will also be compatible with Keyczar in the near future. Java programmers are offered international support, which is expected for Python as soon as possible.

"Cryptography is easy to get wrong. Developers can choose improper cipher modes, use obsolete algorithms, compose primitives in an unsafe manner, or fail to anticipate the need for key rotation. Keyczar abstracts some of these details by choosing safe defaults, automatically tagging outputs with key version information, and providing a simple programming interface," says the team on the official webpage of the product.

Wednesday, September 24, 2008

Benchmarking AJAX ( JSON vs XML )

JSON produces smaller documents, and JSON is certainly easier to use in JavaScript. XMLHttpRequest parses XML documents for you whereas you have to manually parse JSON, but is parsing JSON slower than parsing XML?


Parsing JSON was 2 -10 times faster than parsing XML!

See the results Benchmarking AJAX ( JSON vs XML )

Friday, September 19, 2008

GUI Components » Calendars

31.1 . Open calendar Open calendar
231.2 . Event Calendar Event Calendar
231.3 . Another DHTML Calendar Another DHTML Calendar
231.4 . Calendar in slide tab Calendar in slide tab
231.5 . Calendar (IE only) Calendar (IE only)
231.6 . Displaying the Calendar Displaying the Calendar
231.7 . A Static Calendar by JavaScript A Static Calendar by JavaScript
231.8 . Dynamic HTML Calendar Dynamic HTML Calendar
231.9 . A Dynamic Calendar Table A Dynamic Calendar Table
231.10 . Building a Calculator Building a Calculator
231.11 . Month Calendar (2) Month Calendar (2)
231.12 . Date Time Picker Date Time Picker
231.13 . Another Calendar Another Calendar
231.14 . Fancy Calendar Fancy Calendar
231.15 . Calendar with image for each month Calendar with image for each month
231.16 . Calendar with different theme Calendar with different theme
231.20 . DHTML Calendar for the impatient DHTML Calendar for the impatient






All Javascript Calendars

Thursday, September 18, 2008

Drag two Images DHTML TUTORIAL

JAVASCRIPT DHTML TUTORIALS » Page Components » Image Drag »



 <!-- ***********************************************************

Example 6-2

"Dynamic HTML:The Definitive Reference"

2nd Edition

by Danny Goodman

Published by O'Reilly & Associates  ISBN 0-596-00316-1

http://www.oreilly.com

Copyright 2002 Danny Goodman.  All Rights Reserved.

************************************************************ -->

<html

<head> 

<title>Drag Image</title> 

<style type="text/css">

  body {font-family:Ariel, sans-serif; text-align:right}

  #imgAWrap {position:absolute; left:50px; top:100px; width:120px; height:90px; 

             border:solid black 1px; z-index:0}

  #imgBWrap {position:absolute; left:110px; top:145px; width:120px; height:90px; 

             border:solid black 1px; z-index:0}

</style>

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

/* ***********************************************************

Example 4-3 (DHTMLapi.js)

"Dynamic HTML:The Definitive Reference"

2nd Edition

by Danny Goodman

Published by O'Reilly & Associates  ISBN 1-56592-494-0

http://www.oreilly.com

Copyright 2002 Danny Goodman.  All Rights Reserved.

************************************************************ */

// DHTMLapi.js custom API for cross-platform

// object positioning by Danny Goodman (http://www.dannyg.com).

// Release 2.0. Supports NN4, IE, and W3C DOMs.



// Global variables

var isCSS, isW3C, isIE4, isNN4;

// initialize upon load to let all browsers establish content objects

function initDHTMLAPI() {

    if (document.images) {

        isCSS = (document.body && document.body.styletrue false;

        isW3C = (isCSS && document.getElementByIdtrue false;

        isIE4 = (isCSS && document.alltrue false;

        isNN4 = (document.layerstrue false;

        isIE6CSS = (document.compatMode && document.compatMode.indexOf("CSS1">= 0true false;

    }

}

// set event handler to initialize API

window.onload = initDHTMLAPI;



// Seek nested NN4 layer from string name

function seekLayer(doc, name) {

    var theObj;

    for (var i = 0; i < doc.layers.length; i++) {

        if (doc.layers[i].name == name) {

            theObj = doc.layers[i];

            break;

        }

        // dive into nested layers if necessary

        if (doc.layers[i].document.layers.length > 0) {

            theObj = seekLayer(document.layers[i].document, name);

        }

    }

    return theObj;

}



Read all >>>

Wednesday, September 17, 2008

Easy Grid - Ajax JavaScript

This package can be used to display and data grids using AJAX. It uses Yahoo User interface library Javascript classes to perform AJAX requests. A Javascript script calls Yahoo UI libraries to load the data for the table from the server.
Interactive Grid with Your Own Hands

I am sure being pampered by GUI of desktop applications, users find interfaces of web-applications as extremely uncomfortable. Their notes, probably unexpressed, are timely within AJAX Age. Besides, it is not so difficult to make web-applications more user-friendly. I will not describe whole variety of interface forms in this article, but will concentrate on such an indispensable element as a grid. Almost every web-application needs linear data list management. DB record management of PhpMyAdmin is likely a classical solution in this field. It is a popular solution, but it demands page reloading for every operation, data loss is possible and so on. Let us think about what requirements should be included to be a user-friendly interface should have. The user should have the ability to sort the list by fields, filter the list, the possibility to assign a range of selecting and pagination. With all this going on, only part of the application window should be changed.
Read more >>>

Tuesday, September 16, 2008

HTML : CSS a.class

HTML CSS TUTORIALS » CSS Attributes and Javascript Style Properties » a.class »


Tutorials about HTML : CSS a.class Use a


Related in same category :

CSS background-repeat

Tutorials about how to deal whith CSS background-repeat

Try it background-repeat


Related in same category :

Sunday, September 14, 2008

Hide scripts using comments

<html>

<head>

<title>Hide scripts using comments.</title>

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


<!--


lines of JavaScript code here

...


//-->


</script>


</head>

<body>


Page content here...


</body>

</html>





Try it