Results 1 to 4 of 4

Thread: onMouseOver problems...

  1. #1

    Thread Starter
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    onMouseOver problems...

    Howdy all... First timer on HTML and JavaScript, so forgive me for any stupid questions, but this one has both myself and my teacher baffled.

    I have a page on Microsoft FrontPage, and when the page loads, it starts a clock in a text box. No biggy. Our problem is that we want the user to be able to move their mouse over a line of text and the window.status becomes the day of the week. It keeps telling us that my variable is undefined, and we don't know enough about function declarations to solve it on our own. Can anyone help me?

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343
    post your code please.

    Vince

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3

    Thread Starter
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465
    Here goes...

    Code:
    <html>
    
    <head>
    <title>Current Time</title>
    <meta name="GENERATOR" content="Microsoft FrontPage 3.0">
    <script language="JavaScript">
    <!--
    function startclock(dayofweek)
    {
    var thetime=new Date();
    
    var nday=thetime.getDay();
    var nhours=thetime.getHours();
    var nmins=thetime.getMinutes();
    var nsecn=thetime.getSeconds();
    var AorP=" ";
    
    if (nhours>=12)
        AorP="P.M.";
    else
        AorP="A.M.";
    
    if (nhours>=13)
        nhours-=12;
    
    if (nhours==0)
     nhours=12;
    
    if (nsecn<10)
     nsecn="0"+nsecn;
    
    if (nmins<10)
     nmins="0"+nmins;
    
     if (nday==0)
      nday="Sunday";
    if (nday==1)
      nday="Monday";
    if (nday==2)
      nday="Tuesday";
    if (nday==3)
      nday="Wednesday";
    if (nday==4)
      nday="Thursday";
    if (nday==5)
      nday="Friday";
    if (nday==6)
      nday="Saturday";
    dayofweek=nday
    return dayofweek
    document.clockform.clockspot.value=nday+", "+nhours+":"+nmins+":"+nsecn+" "+AorP;
    
    setTimeout('startclock()',1000);
    
    } 
    
    //-->
    </script>
    </head>
    <script language="JavaScript">
    </script>
    
    
    <body onLoad="startclock(dayofweek)">
    <a HREF="http://www.google.com" onMouseover="window.status=dayofweek; return true">**********
    
    <form name="clockform">
      <p>Current Time:&nbsp; <input TYPE="text" name="clockspot" size="15"></p>
    </form>
    
    <p>Place your mouse here!</a> </p>
    
    <p>&nbsp;</p>
    
    <p>&nbsp;</p>
    </body>
    </html>
    ********** denotes the error line.

  4. #4
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    Here's the code for DayOfTheWeek:
    Code:
    <script type="text/javascript">
    function DayOfTheWeek() {
    now = new Date()
    day = now.getDay()
    days_array = new Array("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday")
    day = days_array[day-1] //I'm not sure about this line, it works today but try it again on monday
    window.status = day
    }
    </script>
    Call it like this:
    Code:
    <a href="#" onMouseOver="DayOfTheWeek()" onMouseOut="window.status=''">Move mouse here to see the day of the week.</a>
    This function shouldn't have anything to do with the clock as yours seemed to do.
    If you've managed to mess up your clock script, you can find plenty online, try either here or www.js-x.com

Posting Permissions

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



Click Here to Expand Forum to Full Width