Methods for outputting information in JavaScript (information confirmation box-Prompt input box-Document Stream output), and javascript input box
The method for outputting information in js is as follows:
1. Document Stream output
document.write('hello');
2. modal dialog box for the output information prompt box
Window. alert ('content to be displayed output'); or alert ('content to be displayed output'); alert (n );
3. Information confirmation box
Var f = window. confirm ('Do you want to enter xinlang net'); confirm (""); if (f) {location. href = 'HTTP: // www.sina.com.cn ';}
4. Prompt input box
Window. promptvar n = window. prompt ('enter your age', 18); if (n> = 18) {document. write ('Welcome young people ');}
5. control tags and output them directly on tags,
You can use document. getElementById ('id') to find the object tag. You can directly control the value and output it.
SetInterval (function () {document. getElementById ('ttt'). innerHTML = "current time:" + new Date (). toLocaleString () ;}, 1000 );
<Script> document. getElementById ('uname'). value = "Alias Name"; </script>
6. output the information directly to the title.
document.title = "hello";
The above section describes how to output information in JavaScript (information confirmation box-Prompt input box-Document Stream output), which is helpful to you, if you have any questions, please leave a message and the editor will reply to you in time. Thank you very much for your support for the help House website!