Using External JavaScript Files

Written by Amrit Hallan

Continued from page 1

I'm going to give you a small example.

Suppose your JavaScript file is "myjfuncs.js".

and it has a function to returnrepparttar bigger number ofrepparttar 105602 two supplied as parameters (you can simply start withrepparttar 105603 function, no need to write

So when we use one of its functions in a JavaScript:

In this way, we can use allrepparttar 105604 complex functions contained inrepparttar 105605 myjfuncs.js file.

Amrit Hallan is a freelance web designer. For all web site development and web promotion needs, you can get in touch with him at or For more such articles, visit You can subscribe to his newsletter [BYTESWORTH REACHOUT] on Web Designing Tips & Tricks by sending a blank email at

Some Useful JavaScript Tricks

Written by Mitchell Harper

Continued from page 1

To changerepparttar text inrepparttar 105601 status bar of a browser window, we just changerepparttar 105602 "status" member ofrepparttar 105603 "window" object, which represents our entire browser window:

window.status = "This is some text";

----------------------------------------------- Using an input box to get text fromrepparttar 105604 user -----------------------------------------------

Just like in traditional windows applications, we can use an input box to get some text input fromrepparttar 105605 user. The "prompt" function is all we need:

var name = prompt("What is your name?"); document.write("Hello " + name);

The prompt function accepts just one argument (the title ofrepparttar 105606 input box), and returnsrepparttar 105607 value entered intorepparttar 105608 text box. Inrepparttar 105609 example above, we getrepparttar 105610 users name and store it inrepparttar 105611 "name" variable. We then userepparttar 105612 "document.write" function to output their name intorepparttar 105613 browser window.

----------------------------------------------- Using a message box to display text torepparttar 105614 user -----------------------------------------------

We can display a message box containing an OK button. These are great when you want to letrepparttar 105615 user know what is happening during their time on a particular page. We can use a message box to displayrepparttar 105616 "name" variable from our previous example:

var name = prompt("What is your name?"); alert("Your name is: " + name);

The "alert" function takes one argument, which isrepparttar 105617 text to display inside ofrepparttar 105618 message box.

----------------------------------------------- Changingrepparttar 105619 title ofrepparttar 105620 browser window -----------------------------------------------

To changerepparttar 105621 title of our web browser's window, we simply modifyrepparttar 105622 "document.title" variable, like this:

document.title = "My new title";

One bad thing aboutrepparttar 105623 "document.title" variable is that we can only manipulate it in Microsoft Internet Explorer. Netscape's implementation of JavaScript doesn't allow us to modify it.

----------------------------------------------- In Closing -----------------------------------------------

As you can see fromrepparttar 105624 examples in this article, JavaScript is a powerful scripting language that we can use to enhance our visitors experience with our site. You shouldn't use JavaScript too much, however, because in some cases it can annoy your visitors and send them packing before your site even loads!

Mitchell Harper is the founder of DevArticles provides its visitors with useful, informative articles on ASP, PHP, and .NET, as well as heaps of tips and tricks that you wont find anywhere else! To see what it's all about, visit devArticles right now at

    <Back to Page 1 © 2005
Terms of Use