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

Grow Your Subscribers Exponentially With These Javascript E-mail Capture Boxes!

Written by Vishal Rao

Continued from page 1

Where '' isrepparttar path to your subscribe.js file. You have uploaded it to your server right?

Includerepparttar 105600 following code inrepparttar 105601 BODY section of your html code:

Where '' isrepparttar 105602 subscribe e-mail address of your list.

The above code will insert a form button in your page and so it is desirable that you insertrepparttar 105603 above code preferably atrepparttar 105604 bottom of your page.

Next, insertrepparttar 105605 following attribute inrepparttar 105606 BODY tag of your html page:


So your BODY tag will look something like this:

That's it !!!

Please don't install this code in allrepparttar 105607 pages of your web site. It will surely be a turn off. Use it wisely.

The only disadvantage of this E-mail Capture box is that those with their e-mail clients not configured properly, won't be able to subscribe to your list :-( Also, your visitor's browser needs to Javascript enabled.

The MAIN ADVANTAGE of this E-mail Capture box is that you'll get genuine e-mail addresses and not fake addresses. The people who subscribe through these E-mail Capture boxes are bound to get your newsletter!

Try it!

Vishal Rao. Vishal Rao publishes an informative e-zine, HomeBiz Opportunities, and is also the author of popular e-book, "E-Business Secrets". Subscribe to his e-zine and grab a FREE copy of Autoresponder Magic PLUS tons of exciting bonuses at

    <Back to Page 1 © 2005
Terms of Use