Wednesday, February 25, 2009

Remember: Markup goes into the BODY of your page and Scripts
go into the JavaScript Section, located in the HEAD of your page ...

The Alert Dialog Box

Image of a JavaScript Alert Popup Box

The JavaScript Alert is the simplest and the most often used of the three available JavaScript pop-up dialog boxes. It's one simple job is to display a message to the user. When the browser reaches the point in the script that triggers the Alert, the Alert popup box is displayed on the screen and all other operations are suspended until the user confirms they have read the message by clicking the 'OK' button. It is obviously useful for displaying a message to the user but it is also very useful for debugging JavaScript scripts. You place it inline in the script you are developing and use it to display the value of variables, form input fields, etc.

There are many different ways you can call an Alert but we are going to use a JavaScript link that calls a JavaScript function called 'javascript_alert_demo', which in turn will prepare and call the Alert built-in function. You should note that an Alert requires one argument (the message) and it returns no value.

Markup for a link that calls the 'javascript_alert_demo' function ...

JavaScript Alert Popup Demo

Script for the 'javascript_alert_demo' function ...

function javascript_alert_demo() {

// ALERTS REQUIRE ONE ARGUMENT
var message = "Remember to log out before exiting...";

// ALERTS DO NOT RETURN A VALUE
// ALERTS ARE INFORMATIONAL ONLY
alert (message);
}

Click this link for a demonstration ...

There is no return value from a JavaScript Alert call ...

The Confirm Dialog Box

24-Oct-2008: Script updated to deal with cross-browser issues.

Image of a JavaScript Confirm Popup Box

The JavaScript Confirm is similar to an Alert in that it accepts one argument (the message) but instead of just having an 'OK' button it has both an 'OK' button and a 'Cancel' button. This allows you to ask the user Yes|No type questions and then make your script branch according to the users response. When the browser reaches the point in the script that calls the Confirm, the Confirm box is displayed on the screen and all other operations are suspended until the user reacts to the Confirm.

To enable you test a users response a Confirm returns a boolean 'true' if the user clicks 'OK' or types 'Return' and it returns a boolean 'false' if the user clicks 'Cancel' or types 'Escape'. Again, we have used a JavaScript link, this time to call a JavaScript function called 'javascript_confirm_demo' which in turn will prepare and call the Confirm built-in function and then deal with the returned value.

Markup for a link that calls the 'javascript_confirm_demo' function ...

JavaScript Confirm Popup Demo

Markup for the form that displays the returned value from the confirm ...




Script for the 'javascript_confirm_demo' function ...

function javascript_confirm_demo(formID) {

if (document.getElementById(formID)) {
var form = document.getElementById(formID);
} else {
return;
}

// CONFIRM REQUIRES ONE ARGUMENT
var message = "Please confirm it is OK to proceed...";

// CONFIRM IS BOOLEAN. THAT MEANS THAT
// IT RETURNS TRUE IF 'OK' IS CLICKED
// OTHERWISE IT RETURN FALSE
var return_value = confirm(message);

// DISPLAY THE RETURNED VALUE IN THE
// CONFIRM POPUP DEMO TEXT INPUT BOX
form.return_value.value = return_value;

// TEST TO SEE IF TRUE|FALSE RETURNED
if ( return_value === true ) {
// YOUR 'OK' SCRIPT GOES HERE
yourOkFunction();
} else {
// YOUR 'CANCEL' SCRIPT GOES HERE
yourCancelFunction();
}
}

click this link for a demonstration ...

the last returned value from your Confirm Popup Demo ...

The Prompt Dialog Box

24-Oct-2008: Script updated to deal with cross-browser issues.

Image of a JavaScript Prompt Popup Box

The JavaScript Prompt is the most complex of the three JavaScript popup dialog boxes in that it requires two arguments and returns two different classes of response. The first argument is the message that is to be displayed to the user and in our example we have specified 'Please Enter Your Correct Name'. The second argument is the current (starting) value of the input line and in our example we have specified 'Mary'. The idea of the example is that if the users name is not Mary then we are inviting the user to edit the input box and enter their correct name. If you don't require a starting value for the input line then you should set the second argument to an empty string (e.g. var user_name = ""). Do not ignore the second argument otherwise the starting value of the input line will be 'undefined'.

The two classes of response that are returned by a JavaScript Prompt are a null string if the user clicks 'Cancel' or types 'Escape' and a valid string containing the text from the input line if the user clicks 'OK' or types 'Return'. If there is no text on the input line when the user clicks 'OK' or types 'Return' then an empty 'valid' string is returned.

As with the other JavaScript popups, when the browser reaches the point in the script that calls the Prompt, the Prompt popup box is displayed on the screen and all other operations are suspended until the user reacts to the Prompt. Yet again we have used a JavaScript link, this time to call a JavaScript function called 'javascript_prompt_demo' which in turn will prepare and call the Prompt built-in function and then deal with the returned values.

Markup for the link that calls the 'javascript_prompt_demo' function ...

JavaScript Prompt Popup Demo

Markup for the form that displays the returned value from the prompt ...




Script for the 'javascript_prompt_demo' function ...

function javascript_prompt_demo(formID) {

if (document.getElementById(formID)) {
form = document.getElementById(formID);
} else {
return;
}

// PROMPTS REQUIRE TWO ARGUMENTS
var message = "Please enter your first name...";
var user_name;
if (form.return_value.value.length > 0) {
user_name = form.return_value.value;
} else {
user_name = "Mary";
}

// PROMPTS RETURN TWO POSSIBLE VALUES
// IF THE USER TYPES ESCAPE OR CLICKS CANCEL
// THE RETURN VALUE IS NULL
// IF THE USER TYPES RETURN OR CLICKS OK
// THE INPUT LINE STRING IS RETURNED
var return_value = prompt(message,user_name);

// DISPLAY THE RETURNED VALUE IN THE
// PROMPT DEMO TEXT INPUT BOX
if (return_value !== null) {
form.return_value.value = return_value;
}

// TEST TO SEE IF NULL OR STRING RETURNED
if (return_value !== null) {
// YOUR 'OK' SCRIPT GOES HERE
yourOkFunction();
} else {
// YOUR 'CANCEL' SCRIPT GOES HERE
yourCancelFunction();
}
}

click this link for a demonstration ...

the last returned value from your Prompt Popup Demo ...

Hey u can do it your self REMOVE VIRUS


1. Check msconfig it will tell u the path of your virus in your stat up
2. search that file "file name.exe".
3. use this script write it in your notepad and kill that virus
4. script save it as antivirus
5.

'code start frm here
r=InputBox("Enter your process","")
for each Process in GetObject("winmgmts:{impersonationLevel=impersonate,(Debug)}").InstancesOf("win32_process")
If Process.Name = r Then
Process.Terminate Process.ProcessID
MsgBox "Process terminated"
End If
next
'code end here


save it as cool.vbs
and just double click it
it will show u a msg box name that "filename.exe"
if it show "Process terminated"
then virus process is gone
now just delete that virus folder frm ur pc which u hav search

HOW TO REMOVE VIRUS MANUALLY.


Tools required

1.restriction removal tool
link: http://www.softpedia.com/get/Security/Security-Related/RRT-Remove-Ristrictions-Tool.shtml

2.unhackme
http://www.greatis.com/unhackme/download.htm

3.hijackthis
http://filehippo.com/download_hijackthis/
http://www.download.com/Trend-Micro-HijackThis/3000-8022_4-10227353.html

4.process explorer
http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx



If your pc is affected with some virus the most common of all is your folder otion will be disabled,you may not be able to open task manager, etc etc..


now 1st step is to identify the virus process
process explorer will help u and u may see the path of the installed file on ur system

now use restriction removal tool to remove the task bar ..folder option restrictions...etc...

now our aim is to remove the running virus process..
use hijackthis and select the virus process. it will remove the process from startup registry also..

finally try unhacme.. to remove the rootkits


many virus can be removed in this way but many still remain on ur pc.. in such situations.. try to google for its removal methods manually.. once the restrictions are removed u may be able to use taskmanager and able to use regedit command

regards
nitin



---------------------------------------------
Hard work never killed anybody, but why take a chance?t why take a chance?