/    Sign up×
Community /Pin to ProfileBookmark

Convert Image to Text

I am searching for a way to convert some navigation images to text, for use in Lynx and other text only browsers. Also I am hoping this will be handy for robots and search engines that browse text links only.

I would use text links at the bottom, but I feel it would be much nicer for them to hold the same position as the images. I am thinking this can be done seperate for each image with if document.images but have never tried something like this.

Thank you,
Caspur

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@CharlesJul 19.2006 — I've de-Dreamweavered a site recently. Take a look under the hood:

http://www.baltimoreaikido.com/
Copy linkTweet thisAlerts:
@slaughtersJul 19.2006 — I am searching for a way to convert some navigation images to text, for use in Lynx and other text only browsers. Also I am hoping this will be handy for robots and search engines that browse text links only....[/QUOTE]Have you tried to put the text in the alt= attribute of the img tag? It was designed for the purpose of having alternative text to show to browsers which do not support images, or to people who have turned image dowloads off in their browser.

You can also explore the use of the media= part of the style sheet link tag in order to have different definitions for one CSS class depending on the media type of the display.
Copy linkTweet thisAlerts:
@CaspurauthorJul 19.2006 — Thanks for the tip Slaughters... I use Alt attributes now, and I will look into the media in CSS, I can't remember coming across that before.
Copy linkTweet thisAlerts:
@slaughtersJul 19.2006 — The CSS approach is probably the best way to go, but here is another thought.

You could probably use some javascript to check to see if the images tags are supported by the browser. If not then just assign the value/innerhtml of the object to be a text phrase (nicely formated) instead of an img

Something like this quick psedo code:[CODE]<html>
<head>
<script>

function LoadButtons () {
if (document.images) {
document.getElementById("HomeNav").innerHTML = '<img src="HomeGraphic.jpg">';
} else {
document.getElementById("HomeNav").innerHTML = '<span class=NavButton>Home</span>';
}
}
</script>
</head>

<body onload="LoadButtons();">
<table>
<tr><td id="HomeNav"><img src="HomeGraphic.jpg"></td></tr>
</table>
</body>
</html>[/CODE]
×

Success!

Help @Caspur spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.8,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...