JS get Element
Document get element by id ' link ' obtains the element element by ID Connection//Documents document get Get
document.getElementById (' link '); Link is the name of an ID in HTML
Function call
1. Direct call to ABC ();
2. Event invocation
element. event = Fuction () {
}
If the script is placed inside the head, you need to add window.onload = function () {};
If you put it inside the body, you don't have to add
001
The ability to display a hyperlink's prompt message
Method 1
<!DOCTYPE HTML><HTML> <Head> <MetaCharSet= "UTF-8"> <title></title> <styletype= "Text/css">#div1{width:100px;Height:100px;Background-color:#ccc;Border:1px solid: #DCECFA;Display:None; } </style> <Script> functionA () {document.getElementById ('Div1'). Style.display='Block'; } functionB () {document.getElementById ('Div1'). Style.display='None'; } </Script> </Head> <Body> <ahref="#"onmouseover= "A ()"onmouseout= "B ()">Website</a> <DivID= "Div1" >for the security of your information</Div> </Body></HTML>Method 1
JS Knowledge Point