Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS alert test page #73

Merged
merged 3 commits into from
Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions features/js-alerts.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Alerts</title>
</head>

<body>
<p><a href="../index.html">[Home]</a></p>

<p>JS alerts</P>
<p id="alertText"></p>

<button onclick="showTextPrompt()">Prompt + Text</button>
<br>
<button onclick="showDefaultAlert()">Default Alert</button>
<br>
<button onclick="showConfirmDialog()">Confirm Dialog</button>
<br>
<button onclick="showAlertWithDelay()">Alert With 4s Delay</button>
<br>

<p>Recursive JS alerts</P>
<button onclick="showRecursiveTextPrompt()">Recursive Prompt + Text</button>
<br>
<button onclick="showRecursiveDefaultAlert()">Recursive Default Alert</button>
<br>
<button onclick="showRecursiveConfirmDialog()">Recursive Confirm Dialog</button>
<br>

<script>
/* eslint-disable no-unused-vars */

function showTextPrompt () {
const defaultText = prompt('Type something', 'Default Text');
if (defaultText != null) {
replaceText('Text Entered: ' + defaultText);
}
}

function showDefaultAlert () {
alert('Default Alert');
}

function showConfirmDialog () {
if (confirm('Select OK or Cancel')) {
replaceText('OK Selected');
} else {
replaceText('Cancel Selected');
}
}

function showAlertWithDelay () {
setTimeout(function () {
showDefaultAlert();
}, 4000);
}

function replaceText (text) {
document.getElementById('alertText').innerHTML = text;
}

function showRecursiveTextPrompt () {
showTextPrompt();
showRecursiveTextPrompt();
}

function showRecursiveConfirmDialog () {
showConfirmDialog();
showRecursiveConfirmDialog();
}

function showRecursiveDefaultAlert () {
showDefaultAlert();
showRecursiveDefaultAlert();
}
</script>
</body>
</html>
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ <h2>Browser Features</h2>
<li><a href="./features/fonts.html">Fonts</a></li>
<li><a href="./features/autoconsent/">Cookie consent</a></li>
<li><a href="./features/navigator-interface.html">Navigator Interface</a></li>
<li><a href="./features/js-alerts.html">JS alerts</a></li>
</ul>

<h2>Security</h2>
Expand Down