Methods for outputting information in JavaScript (information confirmation box-Prompt input box-Document Stream output), and javascript input box

Source: Internet
Author: User

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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.