The method of outputting information in js is as follows:
1. Document stream output
document.write('hello');2. Output information prompt box modal dialog box
window.alert('to output the displayed content'); or alert('to output the displayed content'); alert(n);3. Information confirmation box
var f = window.confirm('Do you want to enter Sina.com'); confirm(""); if(f){location.href = 'http://www.sina.com.cn'; }4. Prompt input box
window.promptvar n = window.prompt('Please enter age',18); if(n>=18){document.write('Welcome to young people'); }5. Control the tag, output directly on the tag,
Find the object tag through document.getElementById('id'), you can directly control the value inside and output it
setInterval(function(){document.getElementById('ttt').innerHTML = "Current time:"+new Date().toLocaleString();},1000);
<script>document.getElementById('uname').value = "Anonymous";</script>6. Export the information directly to the title
document.title = "hello";
The above is the method of outputting information in JavaScript introduced to you by the editor (information confirmation box - prompt input box - document stream output). I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to everyone in time. Thank you very much for your support to Wulin.com website!