[allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => skot:317 [ip] => webforumsuser@m [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 1 [islastshown] => [isfirstshown] => 1 [attachments] => [allattachments] => ) --> > > >[/quote] [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => T.Pastrana - 4Level [ip] => aaaa@aaaa.com [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 2 [islastshown] => [isfirstshown] => [attachments] => [allattachments] => ) --> swapping image with getHours() - Macromedia Dynamic HTML

swapping image with getHours() - Macromedia Dynamic HTML

I want to swap images in a div using javascript getHours(). I've done it in Flash and it worked fine, yet it doesn't seem to here. Here's the code I have: <div id="logo" style="margin:5px 0 0 5px;height:200px;width:200px;cursor:pointer"> <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"> <!-- var dt:Date=new Date(); var hour=dt.getHours(); if (hour>=6 && hour<=14){ doent.write("<img src=logo1.jpg'>") } else if (hour>=14 && hour<=16){ doent.write("<img src='logo2.jpg'>") } else if (hour>=16 && hour<=20){ doent.write("<img src='logo3.jpg'>") } else if ((hour>=20 && hour<=23) || (hour>=0 && hour<=6)){ doent.write("<img src='logo4.jpg'>") } else { doent.write("<img src='logo1.jpg'>") } // --> </SCRIPT> </div>...

  1. #1

    Default swapping image with getHours()

    I want to swap images in a div using javascript getHours(). I've done it in
    Flash and it worked fine, yet it doesn't seem to here.
    Here's the code I have:



    <div id="logo" style="margin:5px 0 0
    5px;height:200px;width:200px;cursor:pointer">
    <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
    <!--
    var dt:Date=new Date();
    var hour=dt.getHours();
    if (hour>=6 && hour<=14){
    doent.write("<img src=logo1.jpg'>")
    } else
    if (hour>=14 && hour<=16){
    doent.write("<img src='logo2.jpg'>")
    } else
    if (hour>=16 && hour<=20){
    doent.write("<img src='logo3.jpg'>")
    } else
    if ((hour>=20 && hour<=23) || (hour>=0 && hour<=6)){
    doent.write("<img src='logo4.jpg'>")
    } else {
    doent.write("<img src='logo1.jpg'>")
    }
    // -->
    </SCRIPT>
    </div>

    skot:317 Guest

  2. #2

    Default Re: swapping image with getHours()


    You have an invalid var declaration. You can't use the semicolon in a var :
    var dt:Date=new Date();
    should be ... var dt=new Date();

    There's also an error in your first image.. It's missing the first ' in the
    img src.
    doent.write("<img src=logo1.jpg'>")
    should be ... doent.write("<img src='logo1.jpg'>")


    --
    Regards,
    ...Trent Pastrana
    [url]www.fourlevel.com[/url]

    Dreamweaver Designer Tools
    iFrameSuite | MiniMenus | Scroller Packages | More...
    -----------------------------



    "skot:317" <webforumsusermacromedia.com> wrote in message
    news:dap54t$eae$1forums.macromedia.com...
    >I want to swap images in a div using javascript getHours(). I've done it in
    > Flash and it worked fine, yet it doesn't seem to here.
    > Here's the code I have:
    >
    >
    >
    > <div id="logo" style="margin:5px 0 0
    > 5px;height:200px;width:200px;cursor:pointer">
    > <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
    > <!--
    > var dt:Date=new Date();
    > var hour=dt.getHours();
    > if (hour>=6 && hour<=14){
    > doent.write("<img src=logo1.jpg'>")
    > } else
    > if (hour>=14 && hour<=16){
    > doent.write("<img src='logo2.jpg'>")
    > } else
    > if (hour>=16 && hour<=20){
    > doent.write("<img src='logo3.jpg'>")
    > } else
    > if ((hour>=20 && hour<=23) || (hour>=0 && hour<=6)){
    > doent.write("<img src='logo4.jpg'>")
    > } else {
    > doent.write("<img src='logo1.jpg'>")
    > }
    > // -->
    > </SCRIPT>
    > </div>
    >

    T.Pastrana - 4Level Guest

  3. #3

    Default Re: swapping image with getHours()

    You are right, it was the :Date that was not correct.

    Thanks!
    skot:317 Guest

Similar Threads

  1. image swapping urgent
    By flashbee in forum Macromedia Dynamic HTML
    Replies: 1
    Last Post: December 2nd, 10:28 AM
  2. need help with image swapping.
    By flashbee in forum Macromedia Dynamic HTML
    Replies: 1
    Last Post: November 30th, 12:10 PM
  3. text and image swapping
    By Chucky1975 webforumsuser@macromedia.com in forum Macromedia Director Lingo
    Replies: 1
    Last Post: December 3rd, 07:30 PM
  4. image swapping in php
    By Markus Ernst in forum PHP Development
    Replies: 4
    Last Post: October 12th, 11:41 AM
  5. Image Swapping (Not Rollover)
    By juicytoast webforumsuser@macromedia.com in forum Macromedia Dreamweaver
    Replies: 3
    Last Post: July 16th, 05:08 PM

Bookmarks

Posting Permissions

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