我需要能够在JavaScript中创建一个函数,我需要做的就是键入h1("hello")并打印hello.
我想避免这种方法:
function h1(text) {
document.write('<h1>'+text+'</h1>');
}
Run Code Online (Sandbox Code Playgroud)
这就是我所拥有的:
function h1(text) {
var div = document.createElement('div');
document.appendChild(div);
var h1 = document.createElement('h1');
div.appendChild(h1);
h1.createTextNode(text);
}
Run Code Online (Sandbox Code Playgroud) 我正在关注Bran的内核开发教程.在他的汇编代码中,他有以下代码块,他描述的不是那么重要,而是与GRUB有关.
; This part MUST be 4byte aligned, so we solve that issue using 'ALIGN 4'
ALIGN 4
mboot:
; Multiboot macros to make a few lines later more readable
MULTIBOOT_PAGE_ALIGN equ 1<<0
MULTIBOOT_MEMORY_INFO equ 1<<1
MULTIBOOT_AOUT_KLUDGE equ 1<<16
MULTIBOOT_HEADER_MAGIC equ 0x1BADB002
MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO | MULTIBOOT_AOUT_KLUDGE
MULTIBOOT_CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
EXTERN code, bss, end
; This is the GRUB Multiboot header. A boot signature
dd MULTIBOOT_HEADER_MAGIC
dd MULTIBOOT_HEADER_FLAGS
dd MULTIBOOT_CHECKSUM
; AOUT kludge - …Run Code Online (Sandbox Code Playgroud) 我正在研究一个用32位C++编写的OS内核.我需要弄清楚如何在C++中启用32位保护模式/启用a20门.所以,你可以告诉我这是否可能,如果可能,怎么样?谢谢.