I am trying to change the text in the browser address field by simulating a click on the anchor tag using javascript. This code works fine in IE, but not in FireFox or Chrome.
<script type="text/javascript"> function UpdateQueryString() { var controlRef = document.createElement('a'); controlRef.id = "t1"; controlRef.href = '#1'; controlRef.innerHTML = ''; document.body.appendChild(controlRef); try { controlRef.click(); } catch (err) { txt = "There was an error on this page.\n\n"; txt += "Error description: " + err.description + "\n\n"; txt += "Click OK to continue.\n\n"; alert(txt); } return false; } </script>
In browsers other than IE, I can find the anchor tag, but an error occurs when the click results are called.
thanks
klone source share