The example in this article tells you how to add a form to a scroll bar in JavaScript. Share to everyone for your reference, specific as follows:
Two ways to achieve this:
First type:
<script type=/"text/javascript/" >
function scrollimg () {
var posx,posy;
if (window.innerheight) {
posx = Window.pagexoffset;
Posy = Window.pageyoffset;
}
else if (document.documentelement && document.documentElement.scrollTop) {
posx = Document.documentElement.scrollLeft;
Posy = Document.documentElement.scrollTop;
}
else if (document.body) {
posx = document.body.scrollLeft;
Posy = Document.body.scrollTop;
}
var Ad=document.getelementbyid (/"ad/");
Ad.style.top= (posy+500) +/"px/";
Ad.style.left= (posx+500) +/"px/";
ad.style.left=/"90%/";
settimeout (/"scrollimg ()/");
</script>
<div id=/"ad/" style=/"Position:absolute;background: #606060; width:100px;height:100px; border:1px dotted #000; line-height:100px;text-align:center; left:103px; top:911px;/"> This advertisement for lease </div>
<script type=/" text/javascript/">
scrollimg ();
</script>
The second type:
More readers interested in JavaScript-related content can view the site topics: "JavaScript Search Algorithm Skills Summary", "JavaScript animation effects and Skills summary", "JavaScript Error and debugging skills summary", " JavaScript data structure and algorithm skills summary, "javascript traversal algorithm and Skills summary" and "JavaScript Mathematical Computing Usage Summary"
I hope this article will help you with JavaScript programming.