Dynadot

Behavior (or Script) for Visited Link Graphic?

Spaceship Spaceship
Watch

mark4man

Established Member
Impact
0
Using Dreamweaver MX for web construction & Photoshop 6.0 for graphics.

I've learned how to create swap image behaviors, where a 2nd image is swapped with the 1st on mouse over.

What I want to do now is assign the 1st image as a link (to another page in my site); & have the 2nd image display (swap) when the link is selected; & remain displayed ...

...in the same way that a simple text hyperlink is displayed as one color, turns a 2nd color on mouse over; & then stays that color when the link is selected (which I believe is referred to as Link & Visited Link.)

Can the same function be created with image files? Is there a Behavior or Script I have missed?

Thanks in advance,

mark4man
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
since ur using a program, im not sure, but do it manually and just dont have an onMouseOut
 
0
•••
To do this you will need to manually edit the source code of your webpage. You must support JavaScript and have some validation or be sure all your clients support JavaScript.

Here is the code, change the text in Green to whatever you want:


<SCRIPT LANGUAGE="JavaScript">
<!--
var image1;
var image2;

image1 =
1.gif;
image2 =
2.gif;
     function changetheimage()
     {
          if (window.document.changemeimage.src == image1)
          {               window.document.changemeimage.src = image2;
          } else {
               window.document.changemeimage.src = image2;
          }
     }
//-->
</SCRIPT>
<A HREF="
yourpage.htm"><IMG SRC="1.gif" onMouseOver="changetheimage()" onMouseOut="changetheimage()" NAME="changemeimage"></a>



Just copy and paste that directly over the HTML and everything that you use for your hyperlink. I havn't tested this, but it is basic enough that it should work correctly.

All you have to do is change the text in green into your information (I.E. If your image was named "mine.gif" you would change "1.gif" into "mine.gif" ect.).

Happy Programming! B-)
 
0
•••
Mp)Tarh

Thanks...I'll try it.

mark4man
 
0
•••
Actually that way will only work for the time they use the page. You'll need to deal with cookies to make this work. I don't know how javascript deals with cookies, but if you wanted to do it with PHP you'd do something like:

PHP:
<?
if($_COOKIE['image'] == TRUE)  $image="image.jpg"; else $image="image-visited.jpg";

setcookie ("image", "1",time()+9999999999999;
?>
<img src="images/<?=$image?>">
 
0
•••
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back