image alt

S

Stijn Goris

hi all,

Is it possible to show an image using 'alt'? Maybee via javascript?

kind regards
Stijn
 
D

Dylan Parry

Stijn said:
hi all,

Is it possible to show an image using 'alt'? Maybee via javascript?

Erm, the "alt" means "alternative" as in a replacement for the image when
images cannot be shown - so what would be the point in showing an image in
replacement if you cannot see that one either??
 
J

Jukka K. Korpela

Stijn Goris said:
Is it possible to show an image using 'alt'?

What do you mean by showing an image and by using 'alt'?
Maybee via javascript?

The point being exactly what?

In an <img> tag, the src attribute specifies the image, while the alt
attribute specifies the textual alternative. What is your problem with
that? (I wonder if the next question is how to show the textual
alternative using 'src'. :))

OK, guessing what you _might_ mean: if foo.png is not available or
cannot be rendered, could we specify something in <img src="foo.png"
....> to tell the browser use bar.img instead?

In practice, no. In theory, you could use
<object data="foo.png" width="..." height="...">
<img src="bar.gif" alt="...">
</object>
but you will probably be disappointed - browsers have implemented the
<object> element very poorly. When foo.png is not available, e.g. IE 6
shows just an empty box.

(It is possible to do content negotiation on the image format, e.g.
send a PNG image to browsers that express their ability to deal with
that and a GIF image to others. But this is a server-side issue and,
besides, browsers generally lie about their capabilities.)
 
S

Stijn Goris

Stijn Goris said:
hi all,

Is it possible to show an image using 'alt'? Maybee via javascript?

kind regards
Stijn

I indeed know what the alt stands for but.. I have a page without the room
to show all the images I want. Therefore I show the filename and want to
create some image next to each filename that when the user floats above that
picture that the actual file shows up.

Maybee via another priciple this can be done also....


kind regards
Stijn
 
S

Steve R.

Stijn Goris wrote in message...
I have a page without the room
to show all the images I want.

So why not use thumbnail image links then?

They are much the best way, and people only look at images they request.
 
S

Stijn Goris

Steve R. said:
Stijn Goris wrote in message...

So why not use thumbnail image links then?

They are much the best way, and people only look at images they request.

Is are thmbnails

It can be a gigantic list of images a user can delete. I want to avoid that
the user fisrt has to click a link to see the thumb. Floating above a link
will be better...
 
G

GD

Stijn Goris said:
I have a page without the room to show all the images I want.
Therefore I show the filename and want to create some image next to
each filename that when the user floats above that picture that the
actual file shows up.

You could have a list of links to each image and then use a Javascript
image-swap to take the link text (if it's the file name) or HREF and use
it as the SRC of an image. If you position the image you can use
Javascript to make the image jump to each link you hover over.

In the HTML have something like:

<body>
<div id="show">
<img src="/images/default.gif"
alt="Select a link to view the image" title="">
</div>
<ol id="list">
<li><a href="/images/apple.gif">apple.gif</a></li>
<li><a href="/images/banana.gif">banana.gif</a></li>
<li><a href="/images/orange.gif">orange.gif</a></li>
</ol>
</body>



IN THE JAVASCRIPT:

onload=function() {
show=document.getElementById('show')
show.img=show.getElementsByTagName('img')[0]
list=document.getElementById('list').getElementsByTagName('a')
for(i=0; i<list.length; i++) list.onmouseover=imgShow
}

function imgShow() {
show.img.src=this.href
item=this
topDistance=0
do topDistance+=item.offsetTop
while(item=item.parentNode)
show.style.top=topDistance.toString()+'px'
}



AND IN THE CSS:

body {
padding:0;
margin:0;
}

#list {
margin:1em 65% 1em 5%;
}

#show {
position:absolute;
top:0;
left:30%;
width:70%;
}

In IE5, Opera 7 and Mozilla, each new image should display at its
original size. If you want to display them all at the same size then
specify a width/height for the image.

Maybee via another priciple this can be done also....

You could use absolute positioning and CSS rollover effects to load all
images but show just one at a time but only Opera and Mozilla have
enough CSS support for that to work.
 
S

Steve R.

Stijn Goris wrote in message ...
It can be a gigantic list of images

How big a list? 20 50? 100? 500? 1000?
Floating above a link will be better .

BUT the user will still have to download those images to see them, so you
might as well stick with the 'thumbnails' option. They only need to be 2K
or less each if they are at a *sensible* size.
 
M

Mark Parnell

BUT the user will still have to download those images to see them, so you
might as well stick with the 'thumbnails' option. They only need to be 2K
or less each if they are at a *sensible* size.

And split them onto separate pages, like most sites do. Say 10-20 per
page or something. Give the user the option to search/filter which ones
they look at. If there are that many of them, most users aren't going to
want to sift through the lot to find what they are looking for anyway.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top