javascript - html: execute function when link clicked, get alert and then redirect to another page -


What is the best way to combine two wires

string 1: < Pre> & lt; A href = "javascript: myFunc ();" Onclick = "warning ('myFunc execution')" & gt; Click here & lt; / A & gt;

and string 2:

  & lt; A href = "http://google.com" & gt; Click here & lt; / A & gt;   

so that: myFunc () executed; The alert appears; Once the alert is clicked, the page is redirected to http://google.com

, I ask the most correct way of doing this I am here.

Thank you.

Try it out:

& lt; A Href = "javascript: zero (0)" onclic = "alert ('myFunc executed'); myFunc (); window.location = 'http: //google.com'" & gt; Click here & lt; / A & gt;

Explanation:

Javascript: zero (0) is to see a link.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -