Behavior (or Script) for Visited Link Graphic?

liunx

Guest
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,

mark4manIt could be simulated using a:active and the background-image: url(mypic.gif); property.

However, since you are using it for buttons anyone without css support would see nothing at all, as you cannot give alt text with the background-image . For this reason you could:

1) use something else
2) add text in the link for those without css
3) add text within a span in the link, give the span a class of 'hide', and then specify

.hide {
display: none;
}

in your css. Hide the css with the @import rule, and anyone who see's the css gets it properly, otherwise they see a plain text hyperlink. You could specify some styles for this in your normal style sheet.

What do you think? I can move your thread to the javascript forum if you prefer (I haven't checked to see if you've already posted there!)

DaveWooooo!

Pretty complex for me (although, I will attempt it.)

It does sound like the most plausible method thus far (everyone else claims it can't be done...or...I am run through behaviors that do not work once I establish the link.

Thanks,

mark4man

BTW - Yes, I did post in the javascript board. Thanks.do you want me to put some example code together?Yes...thanks...

The first image is simply textured text; & the second is the same but with an outer glow...both created in Photoshop 6.0 (I originally had the two set up as a rollover.)

Thanks very much,

mark4manSorry I haven't had time today, but I should have tomorrow.

Thanks

DaveOK here's the example. I haven't had time to test it properly but it works in IE6. It doesn't work in Opera7, but you get the normal link button, so that's not too bad...

<!-- m --><a class="postlink" href="http://www.emdevelopments.co.uk/active/Thanks...I'll">http://www.emdevelopments.co.uk/active/Thanks...I'll</a><!-- m --> try it.

While I have your ear...do you work in Dreamweaver MX at all?

When I created my new site in DW, for each new page I checked a box to make the document XHTML compliant.

What a mistake!

When I run the validator, there are hundreds of errors!!!

Most of them read:

The tag: "html" doesn't have an attribute: "xmlns" in currently active versions.

...or...

The tag: "img" has an XML style closing syntax for an empty element, even though version "HTML4" is not an XML tag language.

I'm really lost...actually, I'm not lost...I'm angry that DW would write the code; & then it's own validator would state that the code is messed up?

Any way to rid myself of all XML & XHTML refferences?

Thanks,

mark4manmmm - you could get a decent editor.... :D LOL J/K

Seriously though, go to <!-- w --><a class="postlink" href="http://www.chami.com">www.chami.com</a><!-- w --> and download a copy of their free html-kit editor. It's a bit difficult to get the hang of, but they've incorporated a copy of html-tidy, and if you click the sweeping brush in the top left corner of the screen it'll do it's best to clear it up for you!

You could enter your html and use their 'Convert to XHTML' option. That's great if your code is reasonably clean originally!

I think dreamweaver has forgotten it needs to code all tags like this:

<br />
<img src=http://www.webdeveloper.com/forum/archive/index.php/"pic.jpg" alt="hello" width="30" height="20" />

Because they don't have a closing tag they need to have that / at the end.

Try html-kit! (you're the second person this morning I've told to convert from dreamweaver to html-kit!) LOL


BTW I haven't opened dreamweaver for months! I kinda got hooked on html-kit! It took me two attempts to get the hang of it, but now it's my default editor and it's on every machine I own!I don't know what validator dreamweaver uses, but the w3c is the best:
<!-- m --><a class="postlink" href="http://validator.w3.org/">http://validator.w3.org/</a><!-- m -->

If you want to post your page in here, or provide a url, I'll take a look and see if I can tell what's wrong or clear it up easily. Rereading your original post it may have put the tags in properly but not changed the doctype...<!-- m --><a class="postlink" href="http://www.moonjams.com">http://www.moonjams.com</a><!-- m -->

Thanks,

mark4man

BTW - I don't want to convert to XTHML...I want to convert back to regular 'ol, ordinary, everyday, average HTML!Dave...as a follow up, let me back up a bit...tell you what I did...& then explain what I came up with tonight...with a few questions:

In my reconstructed site (in which I basically took most of the graphic
content from my old site; & rebuilt a new site, from scratch, in DW), I made
the mistake of creating all my pages as XHTML Compliant. When validated,
there were hundreds of mistakes.

Worse yet, the most important page, which contains a PayPal button linking
to a purchase form at PayPal, did not work at all...& the error was related
to (you guessed it), XHTML!!!

Out of frustration (& not being able to find an answer as how to convert
back to regular, average, everyday, ordinary HTML in the discussion groups),
I compared, through DW's Preferences dialog, new HTML 4.01 page templates,
which were coded as follows:

----------------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

</body>
</html>
----------------------------------------------------------------------------

with new XHTML page templates, which were coded as follows:

----------------------------------------------------------------------------
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>

<body>
</body>
</html>
----------------------------------------------------------------------------

And for the page that didn't work, I changed the DTD's (& all tags prior to
<head>) from the second (XHTML) to the first (HTML)...

...AND NOW THE PAGE WORKS FINE!

So, my questions are:

1) Did I do the right thing?...& can I do the same thing with the rest of my
pages in order to convert back to HTML...

...or...

2) Is converting back more complex than this (realizing that perhaps as DW
created my pages as XHTML compliant, the code for each entire page was
written as XHTML)?

...&...

3) If this is the case, how can I easily & correctly convert the pages back
to HTML?

Thanks,

mark4man

BTW - I intend to move this topic over to XML (where it rightfully belongs, I guess), if you would rather comment over there. Thanks for all your help.
 
Back
Top