How to show a message on hover on page load in javascript? [closed]

I have a php code as shown below in which when Line A is executed, I see a message javascript:alert('Not found') at the bottom left (of the page) on hover. I am wondering if it is best from the user experience point of view.

if (condition) {
    /*  
    
    code
    
    */
    if (file_exists($path)) {
        $choices[0][1] = 'display_file.php?path=' . addressencode($path);
    } else {
        $choices[0][1] = "javascript:alert('Not found')";   // Line A
    }
    continue;
}


if (1 == sizeof($choices)) {
    $address = $choices[0][1];
} 


<area shape="rect" href="<?php echo $address; ?>"
      onclick="if(this.getAttribute('href') !== 'javascript:alert('Not found')' && parent.document.body.rows == '*,0' ) parent.document.body.rows = '55%,45%';"
      alt="<?php echo implode(', ', $records); ?>" />  <!-- Line B -->
  

Problem Statement:

I am wondering what changes I need to make at Line A and Line B so that on hover I can show a different message (at the bottom left of the webpage) or any changes at Line A and Line B which can improve the user experience.