php - Javascript document.GetElementById('iframe_id').src = 'link' working only once -


so here's simple question i'm having difficulties on solving see have iframe , want change it's src depending on link clicked

here's javascript code

function showoverlay(id)     {         var str1 = 'abstract.php?id=';         var link = str1.concat(id);         document.getelementbyid(id).style['display'] = "block";         document.getelementbyid(id).style['opacity'] = "1";         document.getelementbyid('abstract_frame').src =  link;     }      function hideoverlay(el, evt)      {         if (el && evt)         {             el.style.display = evt.target == el ? 'none' : '';         }         document.getelementbyid('abstract_frame').src =  '';     } 

so used document.getelementbyid('abstract_frame').src = link; set src on hideoverlay function used
document.getelementbyid('abstract_frame').src = ''; set src blank link.

so problem when call on showoverlay again set src link iframe different value blank screen

here's html/php

echo '<div class="searchresults">'; echo "      <span class='top'>"; echo "          <a>"; echo "              <h3>". strtoupper($title) ."</h3>"; echo "          </a>"; echo "          <br />"; echo "          <h5 class='sub'>"; echo "authors :"; $tags = explode('|',$run['author']); foreach($tags $i =>$key) {  echo '<a class="authors">dr.'.$key.'</a>';  } echo "<br><br>"; echo "          </h5>"; echo "      </span>"; echo "      <span class='bottom'>"; echo "          <span class='bottomleft'>"; echo                    ($run['abstract'] != "" ? "             <a class='options' data-articlenum='" . $run['reference_number'] . "' onclick='showoverlay(this.dataset.articlenum)'>abstract</a><span style='margin:0px 5px;'>|</span>" : "" ); echo "              <a target='_blank' href='view.php?filename=".strtolower($run['title'])."' class='options'>"; echo "                  full article"; echo "              </a>";   echo "          </span>"; echo "          <div class='overlay' id='". $run['reference_number'] ."' onclick='hideoverlay(this, event)'> "; echo "              <iframe class='abstract' id='abstract_frame'  style='padding:0px;' scrolling='no'>";     echo "              </iframe>"; echo "          </div>"; echo "          <span class='bottomright'>"; echo "              <p class='label'>".$run['journal'].", ". $run['volume'] .", ". date("f, y",strtotime($run['publication_date']))  ."@ pg.". $run['pages'] ."</p>"; echo "          </span>"; echo "      </span>"; echo "      <br style='clear:both;'/>"; echo "</div>"; 

here's visuals

enter image description here enter image description here enter image description here enter image description here


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -