Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Dec 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Focus script breaks dynamic clock

    This focus script is also used by Google:
    Code:
    <body bgcolor="#FFFFFF" text="#000000" onLoad=sf()>
    <script>
    function sf(){document.thisfield.thisfield_text.focus();} 
    </script>
    And it works great for focussing a text input on page load. But it causes a dynamic clock to break, which is found here.

    Could anyone publish the required code change to make them work together? Thank you.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,982
    Thanks
    203
    Thanked 2,536 Times in 2,514 Posts
    You have two onload() statements, and the second over-writes the first.

    onLoad=clockon()
    onLoad=sf()

    You can fix this as follows:-

    <body bgcolor="#FFFFFF" text="#000000" onLoad="clockon();sf()">

    and delete window.onload=clockon from the clock script.

    For more info see:-

    http://www.javascriptkit.com/javatut...iplejava.shtml

  • #3
    New to the CF scene
    Join Date
    Dec 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Great, thank you so much. It's working. Now I'm only having trouble with a character. When the clock was frozen I had it appear with & instead of :. Now it refuses to display that & character. What fixes that?

  • #4
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,333
    Thanks
    11
    Thanked 587 Times in 568 Posts
    use &amp; instead...
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • #5
    New to the CF scene
    Join Date
    Dec 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Great, thank you.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •