View Single Post
Old 06-12-2024, 11:04 PM   #17
andjbock
Hall Of Famer
 
andjbock's Avatar
 
Join Date: Jul 2003
Location: Somerville, MA, USA Bats: Right Throws: Left
Posts: 3,637
Can anyone who has solved this take a quick look at my code to see if anything is preventing my characters from properly converting?

https://ootp.biz/mlb/players/player_28070.html

view-source:https://ootp.biz/mlb/players/player_28070.html

HTML Code:
<!DOCTYPE HTML>
<html>

<head>
  <title>Player Report for #27 Román 'Boom Boom' Tañón</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" type="text/css" href="../styles.css">
  <link rel="stylesheet" type="text/css" href="../mlb.css">
  ******** src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
  ******** src="../scripts/sorttable.js"></script>
  ********>
    function replaceBrokenImages() {
      const defaultImage = 'http://ootp.biz/mlb/images/default_player_photo.png';
      const images = document.getElementsByTagName('img');
      for (let img of images) { // Add event listener instead of directly assigning to onerror property          img.addEventListener('error', function() {              console.log(`Image not found: ${this.src}`);              this.src = defaultImage; // Set default image source          });                    // Check for cached images and force error check          if (img.complete && img.naturalHeight === 0) {              img.dispatchEvent(new Event('error')); // Trigger error event          }      }  }    window.onload = replaceBrokenImages;  
  </script>
</head>

Last edited by andjbock; 06-12-2024 at 11:06 PM.
andjbock is offline   Reply With Quote