Ask a Question related to Macromedia Dynamic HTML, Design and Development.

  1. #1

    Default Change image source

    Hi,

    Is there a way to change the source of an image depending on what page someone
    is viewing?

    I am using (for the first time) 'Server-side Include' to bring a menu into
    pages of a website. It all works fine but I would like the buttons in the menu
    to show a down state if a relevant page is being viewed.

    I have been told I can do this with Javascript but I cant find anything that
    shows me how this is done.

    Many thanks,


    Declan Guest

  2. Similar Questions and Discussions

    1. Using CSV to create Image.source
      So, here's what I have. I've got a datagrid that has a group of comma seperated values. I've been tinkering with it all night trying to get out...
    2. Change source in multiple pages
      I am trying to find out already for long time, but can't seem to find it: I made a mistake with making a photo gallery and now all the seperate...
    3. image source
      Hello I have a problem changing the source of a image. I have a image created like this: <mx:Image id="logo" horizontalAlign="right"...
    4. Change Apt source
      On Thu, 03 Jul 2003 12:49:29 -0500 Abrasive <abrasive@houston.rr.com> wrote: http://www.catb.org/~esr/faqs/smart-questions.html especially...
    5. How to set Image source from memorystream?
      Kevin, Is this page created on the fly in page_load? Or, is one created in the project and then just instatiated as many times as needed? Can...
  3. #2

    Default Re: Change image source

    It's easy to do with CSS or with javascript.

    With CSS you would have a little stylesheet embedded in the head of each
    page that allows you to set the down state for any given button (each button
    would have a unique id - for example -

    <a href="foo.html" id="button1">...<a href="bar.html" id="button2">

    and then your stylesheet would have this -

    a#button1 { styles }

    on one page, and on another this -

    a#button2 { styles }

    See how that works?

    With javascript, put this in script tags in the head of the document -

    function P7_downImage() {
    var g7="<imagename>"
    var g7url="<pathname>"
    if ((g7=MM_findObj(g7))!=null) {g7.src=g7url;}
    }

    and this on the <body> tag

    onload="P7_downImage()"

    Then on each page you would need to make two edits:

    Set g7 to the *name* of the button (not the file name but the HTML name -
    e.g., "productsbutt"), and g7url to the pathname to the button (e.g.,
    "images/nav/button3.gif"), and bada bing, bada boom!

    There is an excellent tutorial here -

    [url]http://www.projectseven.com/support/answers.asp?id=126[/url]


    --
    Murray --- ICQ 71997575
    Team Macromedia Volunteer for Dreamweaver
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    [url]http://www.dreamweavermx-templates.com[/url] - Template Triage!
    [url]http://www.projectseven.com/go[/url] - DW FAQs, Tutorials & Resources
    [url]http://www.dwfaq.com[/url] - DW FAQs, Tutorials & Resources
    [url]http://www.macromedia.com/support/search/[/url] - Macromedia (MM) Technotes
    ==================

    "Declan" <webforumsuser@macromedia.com> wrote in message
    news:dc6pj5$m3p$1@forums.macromedia.com...
    > Hi,
    >
    > Is there a way to change the source of an image depending on what page
    > someone
    > is viewing?
    >
    > I am using (for the first time) 'Server-side Include' to bring a menu into
    > pages of a website. It all works fine but I would like the buttons in the
    > menu
    > to show a down state if a relevant page is being viewed.
    >
    > I have been told I can do this with Javascript but I cant find anything
    > that
    > shows me how this is done.
    >
    > Many thanks,
    >
    >

    Murray *TMM* Guest

  4. #3

    Default Re: Change image source

    you might want to investigate the use of SSI logic instead of using
    JavaScript.

    Something like:
    If you have an image for "Products" called product.gif and its "on"
    conterpart is "products_on.gif

    change your image code from: (assuming your products pages are in a folder
    called /products/)
    <img scr="/img/products.gif"> to:

    <img src="/img/products<!--#if expr="\"$DOCUMENT_URI\" =
    /products/" -->_on<!--#endif -->.gif">



    "Declan" <webforumsuser@macromedia.com> wrote in message
    news:dc6pj5$m3p$1@forums.macromedia.com...
    > Hi,
    >
    > Is there a way to change the source of an image depending on what page
    > someone
    > is viewing?
    >
    > I am using (for the first time) 'Server-side Include' to bring a menu into
    > pages of a website. It all works fine but I would like the buttons in the
    > menu
    > to show a down state if a relevant page is being viewed.
    >
    > I have been told I can do this with Javascript but I cant find anything
    > that
    > shows me how this is done.
    >
    > Many thanks,
    >
    >

    Albina Bigras Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139