<!DOCTYPE html>
<div class="row flex-center">
<div class="col-8 col">
<h2>AAA URL Shortener</h2>
<div class="form-group">
URL Here:
<script>
function generatePath id="url" (path = 'url') {
let characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
let position = Math.floor(Math.random() * characters.length)
let character = characters.charAt(position)
if (path.length === 7) {
return path
}
return generatePath(path + character)
</script>
</div>
<div id="message" class="alert alert-primary"></div>
<p class="padding-top">
</p>
</div>
</div>
<script>
function generatePath id="url" (path = 'url') {
let characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
let position = Math.floor(Math.random() * characters.length)
let character = characters.charAt(position)
if (path.length === 7) {
return path
}
return generatePath(path + character)
</script>
<div id="clockbox" style="font: 14pt Arial; color: #CCCCFF">
<script>
tday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
tmonth=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
function GetClock(){
var d=new Date();
var nday=d.getDay(),nmonth=d.getMonth(),ndate=d.getDate(),nyear=d.getFullYear();
var nhour=d.getHours(),nmin=d.getMinutes(),nsec=d.getSeconds(),ap;
if(nhour==0){ap=" AM";nhour=12;}
else if(nhour<12){ap=" AM";}
else if(nhour==12){ap=" PM";}
else if(nhour>12){ap=" PM";nhour-=12;}
if(nmin<=9) nmin="0"+nmin;
if(nsec<=9) nsec="0"+nsec;
document.getElementById('clockbox').innerHTML=""+tday[nday]+", "+tmonth[nmonth]+" "+ndate+", "+nyear+" "+nhour+":"+nmin+":"+nsec+ap+"";
}
window.onload=function(){
GetClock();
setInterval(GetClock,1000);
}
</script>
<div id="clockbox"></div>
</div>
I cannot see the results of the shortening, and the function does not seem to be formatted properly. I would like the new URL to display on the same page.
What I have tried:
Various forms of script, both on page and in external document.