javascript - Anchor with "computed" URL -


i have js script appends html page pairs: input + anchor

can compute url before redirect happens?

now have link looks this:

<a href="#" onclick="myfunct();return false;">link</a> 

and myfunct uses window.location.href redirect webpage. problem approach cannot (obviously) ctrl+click on link opening goal link in new tab.

details:

  • the link url known after obtaining url server - operation expensive me , in case absolutely necessary.

  • the idea is: user chooses link, he/she clicks it, url obtained server , user redirected (in same window or in new tab if he/she uses ctrl+click)

thanks!

im not entirely looking try giving anchor id

<a href="#" id="mylink">link</a> 

then update href attribute change new location (perhaps on change on input ?

<input onchange="changelink(this)" value="http://www.google.com/"/>  function changelink(elem) {     var mylink = document.getelementbyid('mylink');     mylink.href = this.value;  // prepend value domain } 

every time value in input changes href changed match


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -