Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 815479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:41:26+00:00 2026-05-15T01:41:26+00:00

So I have this php script that output an html table with data about

  • 0

So I have this php script that output an html table with data about some files (like filename, filesize, etc…)

I have this javascript function that displays the picture when you hover a tag belonging to the class “preview”. For example, if a filename is: somePic.jpg, when you hover somePic.jpg in the table, the picture will appear next to your mouse.

Now not all these files are pictures, some are .mp3, so of course when you hover them, the javascript cannot display the picture.
To deal with this case, I added in the tag (generated by the javascript function), an alt attribute: alt=’Preview not available for this type of content.’

And here is my problem, sometimes it works, but sometimes it doesn’t!
Sometimes you start hovering .mp3 links, and the alt attribute is displayed, then you hover a picture, the picture is displayed, then you hover an .mp3 again, and the alt isn’t displayed anymore, but the “broken image” image (the little red cross) is displayed instead…

Sure I could parse the filenames and detect when it’s an mp3 and then deal with the case, but I thought the alt attribute was suppose to achieve this… but it’s buggy…

Any idea? Does anyone already faced this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T01:41:27+00:00Added an answer on May 15, 2026 at 1:41 am

    In general alt is for when images are disabled, rather than as a backstop for error conditions. Whilst IMO it’s a desirable feature that the alt text be displayed in error conditions, the standard doesn’t say it has to:

    For user agents that cannot display images, forms, or applets, this attribute specifies alternate text.

    and indeed browser behaviour varies. WebKit (Safari, Chrome) will only display a broken image icon and never the alt text; IE tries to render the alt text inside a box with an image icon (which frequently displays poorly).

    So you shouldn’t rely on alt text being displayed on error.

    Sure I could parse the filenames and detect when it’s an mp3

    Yes, I think you’ll have to. Not that that’s possible either in the general case since filename/URL extension may well have nothing to do with the actual file type. However if you control all the URLs yourself you may be able to guarantee that all MP3s are called ...mp3.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 509k
  • Answers 509k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can use TRIM in the ORDER BY: ORDER BY… May 16, 2026 at 4:45 pm
  • Editorial Team
    Editorial Team added an answer If you're just trying to get the last part of… May 16, 2026 at 4:45 pm
  • Editorial Team
    Editorial Team added an answer On the front end, do something like this: <html xmlns="http://www.w3.org/1999/xhtml"… May 16, 2026 at 4:45 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have this ajax_update script that updates file.php every 60 seconds.. Now file.php outputs
I have this ajax_update script that updates file.php every 60 seconds.. Now file.php outputs
I have a php script that i run via command line like php file.php
I have a PHP script that launches another script in the background. Recently my
I have a PHP script that reads a file and outputs it to the
I am trying to have a php script that displays a url with user
I have a NSURLConnection that receives data output from a url pointing to a
So, I have built on this system for quite some time, and it is
I created a simple Import script that takes a CSV processes it in PHP
I'm trying to use jQuery.post() function to retrieve some data. But i get no

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.