I remember writing such code in the past was a lot more troublesome, but now it is much simpler to have JQuery, so I can only get it done with a few lines of code!
<script type="text/javascript" src="Js/jquery-1.7.2.min.js"></script> <script type="text/javascript"> $(function() { $(window).scroll(function() { var top = $(window).scrollTop()+200; var left= $(window).scrollLeft()+320; $("#editInfo").css({ left:left + "px", top: top + "px" }); }); }); }); </script> <div id="editInfo" style="float:left;width:300px;background-color:#ccc;position:absolute;top:200px;"> <div>Username: <input type="text" /></div> <div>Password: <input type="text" /></div> <div>Age: <input type="text" /></div> <div>Note: <input type="text" /></div> <div><input type="button" value="Save" /></div> </div> </div> </div>The above DIV implementation code [Recommended] is the entire content shared by the editor with you. I hope it can give you a reference and I hope you can support Wulin.com more.