Blog Tips: Add a control menu to blog to expand and shrink press

zhaozj2021-02-16  70

When you read the article, Blog's menu bar is really too eye, I added a button to control the display and hide of the menu. This can be implemented with JavaScript, but 9CBS Blog is not allowed to join JavaScript directly in the configuration, but we can add JavaScript to a picture in LNLOAD event. Look at me is added to the counting code code, the effect looks at the upper left corner. The program code is as follows:

VAR div = document.createElement ('span'); document.body.insertadjacentelement ('BeforeEnd', Div); div.style.csstext = 'POSITION: ABSOLUTE; Display: block; Top: 42; Left: 2; width: 90; Height: 20; Color: Green; Background: Yellow; border: 2 outset; cursor: hand; '; div.innerText =' << Return Menu '; div.οnclick = function () {var iShide = (RightMenu). Style.display == 'None'); RightMenu.Style.display = Ishide? 'Block': 'None'; div.innertext = ISHIDE? '<< Remarks Menu': 'Expand Menu >>';}

Finally, I will remind everyone to join the script in blog, please be cautious, if you accidentally, you can cause the program to make an error or even the page confusion.

转载请注明原文地址:https://www.9cbs.com/read-14880.html

New Post(0)