Method of outputting information in JavaScript of Information Confirmation Box Prompt Input Box Document Flow Output


The method for outputting information in js is as follows:

1. Document Stream Output

document.write('hello');

2. Output Information Tip Box Modal Dialog

window.alert(' To output what is displayed ');  or  alert(' To output what is displayed ');
alert(n);

3. Information Confirmation Box

var f = window.confirm(' Do you want to enter Sina? '); confirm("");
if(f){
location.href = 'http://www.sina.com.cn';
}

4. Prompt Input Box

window.prompt
var n = window.prompt(' Please enter your age ',18);
if(n>=18){
document.write(' Welcome to your young people ');
}

5. Control labels and output them directly on the labels.

Object labels are found by document.getElementById (‘id’), which allows you to directly control the values inside and output them

setInterval (function(){document.getElementById(‘ttt’).innerHTML = “Current Time:“+new Date().toLocaleString();},1000);

<script>
document.getElementById('uname').value = " nameless ";
</script>

6. Output the information directly to the title

document.title = "hello";