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 4 of 4
  1. #1
    Regular Coder
    Join Date
    Apr 2004
    Location
    Philadelphia
    Posts
    241
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Javascript With CSS

    Okay I can't make anything change dynamically without using a form input...how can I do this with CSS instead... A link to a tuorial or breif explaination would be great

    Thanks In Advance

  • #2
    Senior Coder
    Join Date
    Feb 2004
    Posts
    1,206
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Not sure what you're trying to change dynamically...

    Sadiq.

  • #3
    Regular Coder
    Join Date
    Apr 2004
    Location
    Philadelphia
    Posts
    241
    Thanks
    2
    Thanked 5 Times in 5 Posts
    A Clock
    Heres Example:
    PHP Code:
    CSS>>>
    <
    body onLoad="show5()">
    <
    span id="liveclock" style="position:absolute;left:0;top:0;">
    </
    span>


    JS>>>
    <
    script language="JavaScript">
    function 
    show5(){
    if (!
    document.layers&&!document.all)
    return;
    var 
    Digital=new Date();
    var 
    hours=Digital.getHours();
    var 
    minutes=Digital.getMinutes();
    var 
    seconds=Digital.getSeconds();
    var 
    dn="AM";
    if (
    hours>12){
    dn="PM";
    hours=hours-12;
    }
    if (
    hours==0)
    hours=12;
    if (
    minutes<=9)
    minutes="0"+minutes;
    if (
    seconds<=9)
    seconds="0"+seconds;
    myclock="<font size='5' face='Arial' ><b><font size='1'>Current Time:</font></br>"+hours+":"+minutes+":"
    +seconds+" "+dn+"</b></font>";
    if (
    document.layers){
    document.layers.liveclock.document.write(myclock);
    document.layers.liveclock.document.close();
    }
    else if (
    document.all)
    liveclock.innerHTML=myclock;
    setTimeout("show5()",1000);
    }
    </script> 
    C They SomeHow Combine To View On The Page Without Forms...

  • #4
    Regular Coder
    Join Date
    Dec 2003
    Location
    America
    Posts
    544
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have several questions: First, why do you include additional formatting within the function itself instead of just having a class that references a definition?

    Secondly, how will your function know where to target its goals? You have this in your function:

    Code:
    if (document.layers){ 
    document.layers.liveclock.document.write(myclock); 
    document.layers.liveclock.document.close(); 
    } 
    else if (document.all) 
    liveclock.innerHTML=myclock; 
    setTimeout("show5()",1000); 
    }
    I am no expert, but unless you do something like this,

    Code:
    var obj=document.getElementById( "liveclick" );
    there's no gaurantee that your function will understand what liveclock is.
    LovesWar


  •  

    Posting Permissions

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