Please don't add new questions to a year-old thread. I have branched this to a new thread.
First of all, although it's possible to do what you want, it's not a good idea. The purpose of alt text is to provide a description of an image for the benefit of text-only browsers and assistive technology for the blind. The purpose of the title attribute is to add extra information.
If both the alt text and the title attribute contain the same information, that information is read aloud twice by screen readers for the blind, driving them stir crazy.
Having said that, if you're determined to go ahead, this is how you do it.
- Back up the file(s) you want to edit.
- In the Find and Replace dialog box, select Search Source Code
- Put the following in the Find field: alt="([^"]+)"
- Put the following in the Replace field: alt="$1" title="$1"
- Select the "Use regular expression" checkbox.
- Click Replace All.
The values for the Find and Replace fields must be copied exactly as they are.
Ok, thank you for the reminder about how a screen reader reads things. I am passing that along to my cohorts. A piece of the puzzle that may help is our reasoning for adding the title tag to images is that in IE8 browser the alt text is not always popping up when a user scrolls over the image, and by placing the title tag into the code then the text entered for the title tag does pop up when user scrolls over the image. Is there another/better way to do this?
FYI - So I tried the method you suggested and below is the original code AND then the resulting code. The results only added the info. entered in the replace box verbatim and didn’t copy the alt text and place it in the title tag. It even overwrote my existing alt text.:
Original code –
img alt="US 8 (WIS 35 - US 53) Corridor Preservation overview/location map" height="220" src="images/map-overview.gif" width="300"
img alt="Map key - Thick orange line is the project overview/location, thin purple and green lines are project segments, and the blue tear drop with dot in center are the project boundaries." height="174" src="../../images/map-keymultiseg.gif" width="271"
Resulting code –
img alt="$1" height="220" src="images/map-overview.gif" title="$1" width="300"
img alt="$1" height="174" src="../../images/map-keymultiseg.gif" title="$1" width="271"
I tried the method you suggested and below is the original code AND then the resulting code. The results only added the info. entered in the replace box verbatim and didn’t copy the alt text and place it in the title tag. It even overwrote my existing alt text.:
If that's the case, you have misunderstood my instructions. Below is a screenshot of your image tags and the correct settings in the Find and Replace dialog box. As you can see (you'll need to click the image to enlarge it), the alt text has been correctly copied into the first image tag. The second alt text is selected ready for the replace operation.
The alt text isn't meant to be displayed as a tooltip. Internet Explorer is the only browser that has ever used alt text in that way. As you correctly say, the value of the title attribute is displayed, not only by IE, but by all browsers. But the content of the two attributes should be different. I'm not aware of any way around your situation.
I c and now know what the issue is. Your instructions are for Dreamweaver
Well, that's not surprising since the question was asked in the Dreamweaver forum.
Alas I am only able to use MS Expressions Web version 3 at my govt. work. Do you know how one would do it in MS EW?
Alas, indeed. I happen to have both Expression Web 3 and EW4, and have tested Find and Replace using regular expressions. For reasons known only to Microsoft, you can use regular expressions to find text, but you can't make use of capturing parentheses for replace operations.
Unfortunately, Expression Web is a pale imitation of Dreamweaver, albeit with a more modern interface. I don't know of any way of doing what you want with that program. Sorry.