Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use JavaScript timer to make pop-up window advertisement

Shulou Source: shulou.com Published: 2022-05-31 11:44:43 10月03日 Update

The knowledge of this article "how to use JavaScript timer to make pop-up window ads" is not understood by most people, so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to use JavaScript timer to make pop-up window ads" article.

The specific code is as follows

Title * {padding: 0; margin: 0;} li {list-style: none;} body {background: # 940032;} # counter {width: 500px; height: 420px; background: # 939; margin: 50px auto 0; position: relative;} # counter h3 {line-height: 42px; padding-left: 15px; font-size: 14px; font-family: arial; color: # ff3333;} # counter a {font-weight: normal Text-decoration: none; color: # ff3333;} # counter a:hover {text-decoration: underline;} # bg {width: 280px; height: 200px; border: 3px solid # 680023; background: # 990033; filter: alpha (opacity=80); opacity: 0.8; position: absolute; left: 50%; top: 115px; margin-left:-141px;} # counter_content {width: 250px; position: absolute; top: 130px; left 130px: Z-index: 1;} # counter_content h4 {margin-bottom: 10px;} # counter_content h4 input {border: none; width: 223px; height: 30px; line-height: 30px; padding: 010px; background: url (img/ico.png) no-repeat; text-align: right; color: # 333; font-size: 14px; font-weight: bold;} # counter_content div {width: 250px;} # counter_content input {width: 60px Height: 30px; line-height: 30px; float: left; background: url (img/ico.png) no-repeat-303px 0; text-align: center; color: # fff; cursor: pointer; margin: 0 1px 4px 0; border: 0;} # counter_content div > input:hover {background: url (img/ico.png) no-repeat-243px 0;} # counter p {width: 500px; position: absolute; bottom: 20px; left: 0; color: # ff3333 Text-align: center; font-size: 12px;} simple calculation var showInput = document.getElementById ("input1"); var isClear = false; var tempStr = ""; var clacType = ""; var isContinue = true; function kick (clickValue) {switch (clickValue) {case "=": if (tempStr! = "& clacType! =") {showInput.value = clac (tempStr, showInput.value, clacType); isContinue = false; clacType = "" } break; case "+": case "-": case "*": case "/": / / if the stored operator is not empty, it means continuous operation if (clacType! = "" &! isContinue) {/ / execute the calculation tempStr = clac (tempStr, showInput.value, clacType) first; isClear = true; clacType = clickValue;} else {tempStr = showInput.value; / / the stored character isClear = true after clicking the operator / / indicates that the operator clacType = clickValue;// stored operator} isContinue = true; break; case "C": showInput.value = "0"; isClear = false; tempStr = ""; clacType = ""; break; default:// ordinary numeric button click showInput.value = showInput.value = = "0"? ": showInput.value; isContinue = false; if (isClear) {showInput.value ="; showInput.value + = clickValue IsClear = false;} else {showInput.value + = clickValue;} break;} function clac (num1, num2, type) {switch (type) {case "+": return Number (num1) + Number (num2); case "-": return Number (num1)-Number (num2); case "*": return Number (num1) * Number (num2); case "/": return Number (num1) / Number (num2); default: break;}}

Effect picture:

The above is about the content of this article on "how to use JavaScript timer to make pop-up window ads". I believe we all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to know more related knowledge, please pay attention to the industry information channel.

Tags: Content operators timers Xiao Guang production articles knowledge articles ordinary Code value most characters that is buttons effects effect diagrams numbers more steps Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Shulou Technology MariaDB macOS Docker