html console 查看dom,HTML DOM console.log()用法及代码示例
HTML中的console.log()方法用于在控制台中编写消息。它指示在测试任何程序期间的重要消息。该消息将作为参数发送到console.log()方法。
用法:
console.log( message )
参数:此方法接受单个参数消息,该消息是必需的,用于指定要在控制台上写入的信息。
以下程序说明了HTML中的console.log()方法:
范例1:
DOM console.log() Methodh1 {
color:green;
}
h2 {
font-family:Impact;
}
body {
text-align:center;
}
GeeksforGeeks
DOM console.log() Method
To view the message in the console
press the F12 key on your keyboard.
To view the message, double click
the button below:
View Message
function log_console() {
console.log
("GeeksforGeeks is a portal for geeks.");
}
输出:
HTML中的console.log()方法用于在控制台中编写消息。它指示在测试任何程序期间的重要消息。该消息将作为参数发送到console.log()方法。 用法: console.log( message ) 参数:此方法接受单个参数消息,该消息是必需的,用于指定要在控制台上写入的信息。 以下程序说明了HTML中的console.log()方法: 范例1:DOM console.log() Method h1 { color:green; } h2 { font-family:Impact; } body { text-align:center; } GeeksforGeeks DOM console.log() Method To view the message in the console press the F12 key on your keyboard. To view the message, double click the button below: View Message function log_console() { console.log ("GeeksforGeeks is a portal for geeks."); } 输出: