Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Diaplying Alt image  RSS feed

 
Omkar G. Deshmukh
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

what will happend if i used "<img href='notfound.jpeg'>" this tag in alt feid of my <img href='found.jpeg'> tag. on my page?

will it disply notfound.jpeg image or it will display "<img href='notfound.jpeg'>" as a text.

beacuse i just want to display default image when my image is not available.

 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36406
454
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The page wouldn't load or would be garbled in some way. The alt tab is a text field. It's meant for text readers, not a fall back image.
 
Omkar G. Deshmukh
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
then kindly give me the solution for this...
because on my page i want to display one image if that image is not available on server then i want to display alternate image.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36406
454
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This page shows using JavaScript to check if the image loaded and use a new image if unsucessful
 
Omkar G. Deshmukh
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my logic is to use
.exists() method of java to check that file is exists or not if not then i will use default file.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll need to use JavaScript as Jeanne has suggested, not Java.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36406
454
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unless these files are on the same server. In which case you can write out the proper image in the first place. But then you wouldn't need the "alternate file logic" in your HTML/JSP file.
 
Omkar G. Deshmukh
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank for your solutions .

but i am goiing to use this code on mobile handset thats why i cant use javascript . beacause some handset supports javascript and some not.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then your best bet is to handle it on the server as suggested by Jeanne's most recent reply.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!