Javascript examples for DOM:Element setAttribute
Add datetime inside a html url
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <script type="text/javascript"> function addtimestamp() {// w ww. j a v a 2s . co m var link = document.getElementById('link'); var now = new Date().getTime();; link.setAttribute("href", "/controllername?t=" + now); } </script> <a id="link" onclick="addtimestamp()" href="/controllername?t=">url</a> </body> </html>