Displaying The Correct Time For World Cities With AJAX / JavaScript / DOM
Recently asked on Yahoo! Answers:
I’m working on JavaScript, and my assignment is to write a page that when you click on the radio button of a city and click update, it displays the time in the text box. however, its not working – can you help? (i’m on a library computer without admin privledges and without firefox so i can’t debug)
I could have fixed the supplied code but it didn’t make use of certain efficiencies; additionally, I wanted to add some code that would increase the accuracy of the results — such as working from a single date object to compute all time, checking for Daylight Saving Time, etc.
So, without further ado, here’s the code. And, as always, the end of this post includes a link to a working demo, which you can save and use yourself.
Continue reading: Displaying The Correct Time For World Cities With AJAX / JavaScript / DOM »
Good, Free Web Hosting Companies
A common question on Yahoo! Answers is where to find good, free Web hosting companies. More often than not, the request is that they also be ad-free.
I can recommend the following Web hosts because I have used them all for various purposes. Each has its limitations, but remember, you get what you pay for, even on the Internet.
A quick aside on free domain names: There are no free domain names. At least, none that are worth the aggravation. (For total n00bs, a “domain name” is like this site’s dougv.com, or yahoo.com, youtube.com, whatever.com.)
Stupid Web Site Tricks
Recently asked on Yahoo! Answers:
Is background music on websites to unprofessional?
[snip; was a URL]
that is my website I am working on for my uncle
I was thinking about putting some background music on it
(just a piano playin in background)is this a good idea or should I not do it?
and what changes can I make to the site to make it look better? what can I add, what should I take off?
Which provides me with an excellent segue to point out all the annoying crap people on Yahoo! Answers insist on putting into their Web sites. I’ve listed the annoyances in order, from worst to simply just offensive.
If you do any of the following on your Web site, your site is awful. If you do more than one, you should immediately remove your site altogether, because it’s a crime.
Using PHP / MySQL To Store A Form Value Calculated Via JavaScript / DOM
Recently asked on Yahoo! Answers:
without pressing anything then when it displays the result on a certain fields inside a form then pressing the submit button it will be save to mysql database…. I know already the saving but the computation syntax inside the form… how?
I’m taking this to mean that the questioner wants:
- a user to be able to make some changes to a couple textboxes, or maybe even a radiobuttonlist;
- automatically calculate a sum from those inputs via JavaScript /.DOM;
- display that calculated value in a readonly textbox;
- then insert the value of the readonly textbox into a MySQL database when the form is submitted.
Once again, what seems straightforward is a bit more complicated than you would think, but we can certainly accomplish what he is after and have it work with Internet Explorer / Mozilla browsers. Here we go!
Continue reading: Using PHP / MySQL To Store A Form Value Calculated Via JavaScript / DOM »
Showing Or Hiding HTML Form Elements With JavaScript
Recently asked on Yahoo! Answers:
AJAX – show an extra text field if one radio button is pressed?
I’m looking for a short AJAX script that would add an extra textfield into a form if in the radiogroup a certain button is pressed.
Example
( ) yes ( ) no < if ‘no’ choosen
Before I get into answering this question, I’m going to launch into a tirade against the worst kind of Yahoo! Answers jackasses: The self-styled know-it-alls who curse darkness, rather than lighting candles.
Certain people on Yahoo! Answers can be counted upon to provide terse, arrogant, useless replies to serious questions. Most often, it’s something along the lines of, “You mean {confusing term} and it is {harangue that doesn’t answer question}. You can do this: {obscure, curt instructions}.”
Being brief when a question is succinct and appropriate is a virtue, so long as it’s obvious the person will understand your answer. It’s also perfectly fine, in my opinion, to ridicule totally moronic questions (such as, “How do I make a chat program?”, “How do I become a hacker?”, “How do I visit MySpace from school? They block it” or “How do I crack the serial number for this program?”).
But when someone (such as this questioner) makes a perfectly reasonable request, clearly demonstrates he has limited knowledge of the subject, makes it clear what he is after and what language he wants used, and even goes so far as to specifically ask for code, you’re not helping if you only say, “That isn’t AJAX, it’s JavaScript,” even if you add in some information that person clearly won’t understand.
Continue reading: Showing Or Hiding HTML Form Elements With JavaScript »

