To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > Misc Help > ClientSide Technologies

ClientSide Technologies Discuss HTML/CSS/Javascript, and any other client-side technologies, here.

Reply
 
Thread Tools Rate Thread Display Modes
Old 03-11-2006, 07:02 AM   #1
ktsirig
Member
 
Join Date: Sep 2005
Posts: 47
Newbie Javascript questions

Hello all!
I am starting to use JS a couple of days now and mainly I am interested in using it in form validation and to create pop-ups.
I have 2 questions :

1) If a user doesn't have JS enabled, how will I check for empty fields in the form and show an alert box that prompts for corrections?

2) Also, I have seen sites that have the following : There is a link somewhere which works like this : [a] if you have JS enabled, it "recognizes" it and gives a pop-up window when clicked whereas [b] if you don't have JS enabled, it simply acts like a link and opens a new window (not a poup-up one).

Because I am a bit confused, I am starting to think that maybe JS causes more problems than it solves... Should a programmer use it or ,for instance, do a form validation in another page and don't count on the user having JS enabled?
ktsirig is offline   Reply With Quote
Old 03-11-2006, 07:09 AM   #2
Skull
Senior Member
 
Skull's Avatar
 
Join Date: Jul 2003
Location: Scotland
Posts: 149
1) You have the server side script check for errors aswell as the clientside javascript check. That way if they don't have Javascript turned on, your server side script can do the validation.

2) <a href="new.html" target="_new" class="popup">Text</a>

when the page loads, you call a javascript function which loops through all of the anchor tags that have the classname popup and change the href to a javascript function which opens a pop up. If the user doesn't have javascript turned on, then it won't change thte anchor tags leaving just a normal hyperlink which opens in a new window.

You should think of javascript as more of an extra rather than an alternative. For the people who have it turned on, they get things working faster (such as client-side validation) and for those who have it off, they just have things work the normal way.
__________________
Blaine Young
http://www.linksuk.com
Skull is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 01:09 PM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.