Alert, prompt and document.write functions are most commonly used for user interaction and writing some content on browser window.
- Alert is used to display some warning message window
- Prompt is used to capture user input
- Confirm is used to capture Yes/No or OK/Cancel response from user in order to perform further activity
- Write is used to write some text on browser window.
Below are some examples of using these functions.
Using Alert function:
var browserInfo = '';
browserInfo = "Browser CodeName: " + navigator.appCodeName + "\n\r";
browserInfo += "Browser Name: " + navigator.appName + "\n\r";
browserInfo += "Browser Version: " + navigator.appVersion + "\n\r";
browserInfo += "Cookies Enabled: " + navigator.cookieEnabled + "\n\r";
browserInfo += "Platform: " + navigator.platform + "\n\r";
browserInfo += "User Agent: " + navigator.userAgent + "\n\r";
What is scripting language? "Scripting language is not compiled rather it is interpreted. VBScript and Perl are other scripting languages."