Live clock

How can store this code in a file js and call div#id?
I dont want call this code with input#id. I want call this code with div#id.
What is your suggestion?

<script type="text/javascript">
            var int=self.setInterval("clock()",1000);
            function clock()
            var d=new Date();
            var t=d.toLocaleTimeString();

Use innerHTML instead of value.

Thank you, worked
How do I set in the file js and call with div#id?
How is make live clock in jQuery?

The web page would only show the time of the computer that it is running on.

If you want to instead show the accurate time of a certain location, sites like provide free clocks for your web site