How to implement a gadget in a website ?


I would like to implement some kind of "gadget" in a website that could show the weather and the time. I know both depend on the location, is there any way to detect the area where the user is connected. Is this a free service?

In case the weather could be a complication, could you tell me how to show only the time ?

Thanks in advance.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Use javascript to get the client machine time.

var now = new Date();

var hour = now.getHours();
var min = now.getMinutes();
var second = now.getSeconds();

alert(hour + ':' + min + ':' + second);

Open in new window

There's always google gadgets...


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dimensionavAuthor Commented:
How could I show that date permanently in a cell of a table ?
Try below kind of code.

60 secs once, the function DisplayTime will be called and the time will be updated in table cell tdTest.
function DisplayTime()
        var now = new Date();
        var hour = now.getHours();
        var min = now.getMinutes();       
        document.getElementById("tdTest").innerHTML = hour + ':' + min;
    setInterval ( "DisplayTime()", 60000 );

<table><tr><td id="tdTest"></td></tr></table>

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.