This article example shares the specific code of JavaScript to implement the scroll window for your reference. The specific content is as follows 1. Implementation effect diagram2. Knowledge points involvedThe window.open() method is used to open a new browser window or find a named window. moveTo(): The method can move the upper left corner of the window to a specified coordinate. window.screen.height: screen pixel height window.screen.width: the width of the screen in pixels window.screenLeft; The distance from the left side of the screen window.screenTop; the distance from the top to the screen setTimeout: The method is used to call a function or calculate an expression after a specified number of milliseconds, setTimeout(function, milliseconds). 3. Code Implementation<!DOCTYPE html> <html lang="utf-8"> <head> <meta charset="UTF-8"> <title>Scrolling Window</title> <script> var w ;//page width var h;//page height var x;//horizontal distance from the screen var y;//vertical distance from the screen var v = 5;//horizontal position of each movement var s = 8;//vertical position of each movement function windowOpen(){ mywindow = window.open('','','width=200px,height=100px'); mywindow.document.write("This is an open window"); w =window.screen.width; h=window.screen.height; x=window.screenLeft; y=window.screenTop; windowmove(); } function windowmove(){ if(x<0||x>w){ s=-s; } x=x+s; if(y<0||y>h){ v=-v; } y=y+v; mywindow.moveTo(x,y); setTimeout(windowmove,10); } </script> </head> <body> <input type="submit" value="Open window" id="windowOpen" onclick="windowOpen()"> </body> </html> The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Practical method of upgrading PHP to 5.6 in Linux
>>: Explanation of the problem of selecting MySQL storage time type
Steps to configure whitelist access in mysql 1. L...
JPQL stands for Java Persistence Query Language. ...
The datetime type is usually used to store time i...
introduction I discovered a problem before: somet...
I chose node.js to build the server. Friends who ...
This article example shares the specific implemen...
Download and install MySQL 8.0.22 for your refere...
Table of contents 1. Understanding Queues 2. Enca...
This article shares the specific code for the WeC...
On the server, in order to quickly log in to the ...
1. About the file server In a project, if you wan...
This article example shares the specific code of ...
Introduction to Text Shadows In CSS , use the tex...
Table of contents Preface Query usage scenario ca...
Take 3 consecutive days as an example, using the ...