Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6916041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:33:06+00:00 2026-05-27T09:33:06+00:00

I’m modifying an existing html/javascript package to be used as a iPhone lockscreen. I

  • 0

I’m modifying an existing html/javascript package to be used as a iPhone lockscreen. I want it to look like this:

alt text

I decided to add the CSS and Javascript in the HTML so you can test it out straight away:

<html>
<head>

<script language="Javascript">
var now             = new Date ( );

function getClock ( )
{
  var hours     = now.getHours ( );
  var minutes   = now.getMinutes ( );
  minutes       = ( minutes < 10 ? "0" : "" ) + minutes;

  var daypart   = ( hours < 12 ) ? "AM" : "PM";
  hours         =  ( hours > 12 ) ? hours - 12 : hours;
  hours         = ( hours == 0 ) ? 12 : hours;

  var clock     = hours + ":" + minutes + " " + daypart;

  document.getElementById("clock").firstChild.nodeValue     = clock;
}

function getCalendar ( )
{
  var days      = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
  var months    = new Array("January","February","March","April","May","June","July","August","September","October","November","December")

  var date      = now.getDate()
  var month     = now.getMonth()
  var day       = now.getDay()

  document.getElementById("date").firstChild.nodeValue  = date;
  document.getElementById("month").firstChild.nodeValue     = months[month].substring(0, 3);
  document.getElementById("day").firstChild.nodeValue       = days[day];
}

</script>

<style type="text/css">
body  { font-family: Calibri; color: #fff; background-color: #000; position: absolute; }
#clock { width: 300px; position: absolute; top: 50%; margin: -.7em 0 0 20px; font-size: 53px; text-shadow: -1px 0 #585858, 0 1px #585858, 1px 0 #585858, 0 -1px #585858;}
#day { font-size: 0.9em; line-height: 35px; }
#month { position: absolute; right: 0px; font-size: 1.91em; line-height: 99px; }    
#date { position: absolute; left: -125px; top: 0px; width: 102px; text-align: right; }
</style>   
</head>

<body onload="getClock(); setInterval('getClock()', 1000 ); getCalendar(); setInterval('getCalendar()', 1000 )">

<div id="background">
<img src="http://dc463.4shared.com/img/32MahG4Y/s7/0.15818551454745688/Background.jpg" width="320" height="480">
</div>

<div id="clock">
    <div id="day">
    </div>
    <div id="month">
        <div id="date">
        </div>
    </div>
</div>      
</div>

</body>
</html>

As of now, I’ve two unsolved problems:

  1. Like the sample image, I want the month to almost touch the right edge of the screen while at the same time keep the same amount of left margin. This can only mean one thing: resizing the font to make it fit. This must probably be done in Javascript.
  2. The text borders are currently I now use (using text-shadow) are quite ugly, and if you compare my image with the sample image you see borders make all the difference! Is there a way to make them a bit more fluid?

I hope anyone can give some ideas on how to solve these points. Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:33:07+00:00Added an answer on May 27, 2026 at 9:33 am

    First, enclose all elements in a div and position that relatively. This will assist in keeping other, internal div positioned accordingly.

    <body onload="getClock(); setInterval('getClock()', 1000 )">
        <div id="clock">
            11:06 AM
            <div id="date">
                Sunday
            </div>
            <div id="month">
              <script language="JavaScript">getCalendar(); setInterval('getDate()', 1000 )</script>  
              <script language="JavaScript">getCalendar(); setInterval('getDate()', 1000></script>
            </div>
        </div>
    </body>
    

    Note I’ve removed the #day div, it wasn’t needed I’ve also enclosed everything inside the #clock div so that all elements are positioned based upon the #clock position. If you need the #day div back for the scripting, simply add it to the html around the script and don’t style it in the CSS.

    The CSS (font sizes are guesses based on your linked sample image)…..

    #clock { font-size: 40px; position: relative; top: 50%; margin: -.5em auto 0 auto; }
    #date { position: relative; text-align: left; margin: 0 0 0 40px; }
    #month { float: right; font-size: 80px; margin: 0 20px 0 0;}
    

    If it helps, here’s a copy/paste HTML file so you can play with it. Note I added the body CSS and the #myscreen div to mimic the size of the phone’s screen. They aren’t needed for actual deployment on the phone.

    <html>
    </head>
        <style  type="text/css">
            body { text-align: center; font-family: verdana; background: #fff; color: #fff;}
            #myscreen { position: relative; width: 320px; background: #333; height: 480px; }
    
            #clock { font-size: 40px; position: relative; top: 50%; margin: -.5em auto 0 auto; }
            #date { position: relative; text-align: left; margin: 0 0 0 40px; }
            #month { float: right; font-size: 80px; margin: 0 20px 0 0;}
        </style>
    </head>
    
    
    
    <body onload="getClock(); setInterval('getClock()', 1000 )">
        <div id="myscreen">
            <div id="clock">
                11:06 AM
            <div id="date">
                Sunday
            </div>
            <div id="month">
              29 <script language="JavaScript">getCalendar(); setInterval('getDate()', 1000 )</script>  
              Aug <script language="JavaScript">getCalendar(); setInterval('getDate()', 1000></script>
            </div>
            </div>
        </div>
    </body>
    </html>
    

    Decreasing or increasing the -.05em margin for the #clock div will move the entire block of elements up or down.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code to decode numeric html entities to the UTF8 equivalent character.
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.