简体   繁体   English

单击时刷新或刷新页面

[英]Reload or Refresh Page when clicking

Hi any help how can i refresh may page everytime i click a link? 大家好,每当我单击链接时,如何刷新页面? heres my code 这是我的代码

function myFunction(id) { 
      var x=document.getElementById(id) 
      document.getElementById('t_id').value=x.id; 
}

HTML HTML

<a href="docview.php?id=30" id="30" onclick="myFunction(30)" class="30" 
          target="iframe_a">August 7, 2013</a></li>

Use the reload function : 使用重载功能:

<script>
function myFunction(somval)
  {
  location.reload();
  }
</script>

This will refresh each time if not then use this code: 如果没有,它将每次刷新,然后使用以下代码:

function myFunction(id) { 
      var x=document.getElementById(id) 
      document.getElementById('t_id').value=x.id; 
      return true;
}

And HTML will be: HTML将是:

<a href="docview.php?id=30" id="30" onclick="return myFunction(30)" class="30" 
          target="iframe_a">August 7, 2013</a></li>

OR you can add this line in the JS function at the end: 或者,您可以在JS函数的最后添加以下行:

window.location.reload();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM