Monday 13 November 2017

html - Multiple buttons with Javascript confirm and window.location

I want to make a list of text/buttons that prompts a box
with a yes/no-option when the user clicks it. If the user presses yes, they get
redirected to another site. If no, they are just prompted with a explaining they can't
continue without pressing yes.



This is what I
have as of now:




data-lang="js" data-hide="false" data-console="true"
data-babel="false">

class="snippet-code-html lang-html prettyprint-override"> type="text/javascript">




type="button" onclick="confirmation()" value="Go to
Google.com">





type="text/javascript">





type="button" onclick="confirmation()" value="Go to
StackOverflow.com"/>







Unfortunately,
this makes both buttons refer the user to stackoverflow.com. It always seem to apply the
last "window.location" to all buttons that I
add.



I would want each button to link to a
different site. Any help is greatly appreciated.

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...