I'm embarassed to ask but I need help getting these scripts to work together and output what I'm looking for:
HEAD section, first script:
function copyToClipboard(s) {
if (window.clipboardData && clipboardData.setData) {
clipboardData.setData('text', s);
}
}
HEAD section, second script:
var name=prompt("Enter your first and last name please.","name");
function displayDate()
{
document.getElementById("time").innerHTML="Edited on " + Date() + " by " + name + ";
}
BODY section:
<button type="button" onclick="displayDate()">Display Date</button>
<strong><a href="javascript: void(0)" id="copy" onclick="copyToClipboard(document.getElementById('time').innerHTML)"><span id="time">Date and time will display here</span></a></strong>
So basically what I'm trying to accomplish here is a webpage that prompts the user to enter their first and last name when the page loads. Then when they click the button that's labeled "Display Date", the span labeled "time" should change to something like:
Edited on Thu Jan 01 12:59:59 2099 by John Doe
The way I have the current script is giving me a "Unterminated string constant" error when the page loads. When I click the button I get an "Object expected" error.
Can anyone provide any suggestions please?