I don't know why I don't get the alert message when I do a mouseover on the link.

The link is for users to download a pdf.
I want to alert them to know they will get a pdf if they click on the the link, when they mouseover the link they get a message pdf file to download
The mouseover isn't happening?? The error says type error document.getElementById is null.

This is my code.

<script type="text/javascript">
    document.getElementById('id').onmouseover = function() { alert('click to download pdf') } 
</script>

This is the anchor link
<a href="white_papers/Monitoring_of_stem_cell.pdf" target="_blank" onMouseOver="this.id=''" id="stem_cell"

Monitoring of stem cell</a>

THANKS!

    The <a> element you posted does not have an id of "id" (which is what your Javascript code is looking for).

      I rewrote it but I get another error. Syntax missing formal parameter. Is the problem the anchor?

      <script type="text/javascript">
          document.getElementById('id').onmouseover = download_hint;        
      function download_hint(id){id.alert("click to download pdf")}; </script>

      <a href="white_papers/Monitoring_of_stem_cell.pdf" target="_blank" onMouseOver="this.id=''" id="stem_cell"

      Monitoring of stem cell</a>

        It still doesn't give the alert when I do the mouseover but I'm not getting any errors?IT just doesn't fire. Thanks,

          var thisId=  document.getElementById('id'); 
                  thisId.onmouseover  = download_hint;
        
        function download_hint(){alert("click to download pdf");}
        
        
        div class="object">
        <object data="white_papers/sp6800/Chimerism_Analysis.pdf" type="application/pdf" width="100%" height="100%" > 
          <p>It appears you don't have a PDF plugin for this browser.
              Click here to download the pdf file.
          <a class="h3cal" href="data/Chimerism_Analysis.pdf">
          Chimerism Analysis </a></p>
        </object>
              <a class="h4cal" href="white_papers/sp6800/Chimerism_Analysis.pdf" target="_blank"   id="hla_antibody" >Chimerism Analysis </a>                               
        </div>

          The <a> element you posted does not have an id of "id" (which is what your Javascript code is looking for).

            Write a Reply...