EVILSOFTS...
Would you like to react to this message? Create an account in a few clicks or log in to continue.


TOTALLY EVILINSIDEZZ...
 
HomeLatest imagesSearchRegisterLog in

 

 Learn JAVA Script - BASICS

Go down 
2 posters
AuthorMessage
devendra
developer
developer



Posts : 3
Join date : 2010-09-21

Learn JAVA Script - BASICS Empty
PostSubject: Learn JAVA Script - BASICS   Learn JAVA Script - BASICS Icon_minitimeWed Sep 22, 2010 3:49 am

Question Question Question Question

<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Beginning of JavaScript -
function MsgBox (textstring) {
alert (textstring) }
// - End of JavaScript - -->
</SCRIPT>
</HEAD>
<BODY>
<FORM>
<INPUT NAME="text1" TYPE=Text>
<INPUT NAME="submit" TYPE=Button VALUE="Show Me" onClick="MsgBox(form.text1.value)">
</FORM>
</BODY>
</HTML>

BREAK DOWN of CODE

In the <HEAD> area, a new pair of tags has been introduced: <SCRIPT> and </SCRIPT>

All browsers currently assume you are programming in JavaScript, but other programming languages might come along in the future. As a result, it is standard form to open your scripting area with:
<SCRIPT LANGUAGE="JavaScript">

You can name your functions anything you want. I chose to name mine MsgBox, but I could have named it Kalamazu or something else.

A function is typed like this:



function MyFunction (variable) {

(stuff you want to do with the variable)
}
This animation shows how a number can be passed to the variable "data" and then used in a function written for that variable.

The variable can be a number, a piece of text, or a date.
The curly brackets { } define the beginning and end of the function.

--------------------------------------------------------------------------------

The alert command will create an message box displaying a piece of text or a number.
Alert("Hello World") will display Hello World in the box.
Alert(SomeText) will assume that SomeText is a variable, and will display whatever value it contains. Notice that "Hello World" was in quotes and SomeText was not. If I put these two lines together:
SomeText="My Three Sons"
Alert(SomeText)
then My Three Sons will be displayed in the message box.
--------------------------------------------------------------------------------
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
< !-- Beginning of JavaScript -
function MsgBox (textstring) {
alert (textstring) }
// - End of JavaScript - -->
</SCRIPT>
</HEAD>


Question Question Question Question
Back to top Go down
Admin
Admin
Admin
Admin


Posts : 44
Join date : 2010-09-20
Age : 34
Location : mumbai

Learn JAVA Script - BASICS Empty
PostSubject: Re: Learn JAVA Script - BASICS   Learn JAVA Script - BASICS Icon_minitimeWed Sep 22, 2010 3:51 am

nyc share devendra... keep sharing more codes and scripts Very Happy

for simple alert message box we can also use a script of few lines as follows Wink
==============================================================================================
<script language = "javascript">
<!--
alert(" msg text")
//-->
</script>
==============================================================================================

by including this script whenever anyone will visit your site, the visitor will get the alert message box with the msg text you provided... Wink

ENJOY.... Wink
EVILSOFTS RULZZZ... Twisted Evil
Back to top Go down
https://evilsofts.forumotion.com
 
Learn JAVA Script - BASICS
Back to top 
Page 1 of 1
 Similar topics
-
» Java script - Change color

Permissions in this forum:You cannot reply to topics in this forum
EVILSOFTS... :: DEVELOPING TOOLS-
Jump to: