user3034828
user3034828

Reputation: 73

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

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

Upvotes: 1

Views: 146

Answers (2)

Code Lღver
Code Lღver

Reputation: 15593

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:

<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:

window.location.reload();

Upvotes: 0

crafter
crafter

Reputation: 6297

Use the reload function :

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

Upvotes: 1

Related Questions