It's free and you have access to premium codes!
Welcome back! Please login to your account.
Don't worry, we'll send you a message to help you to recover your acount.
Written by 21 August 2012
In this code, a box with a text inside follows the cursor. If the cursor stays in one place, this box also stays in the same place, and by moving the mouse cursor, this box follows it. You can use this code when you want your site name, or any other text, to be in front of the user's eyes or when you want to give a new message or alert to the user.
<!-- this script is provided by www.javascriptfreecode.com coded by: Kerixa Inc. -->
<SCRIPT language="JavaScript">
var scroller_msg='W W W . javascriptfreecode . c o m'
var dismissafter=0
var initialvisible=0
if (document.all)
document.write('<marquee id="curscroll" style="position:absolute;width:100px;border:1px dotted silver; font-family:Tahoma;font-size:11px ;background-color:#eaeaea ;visibility:True">'+scroller_msg+'</marquee>')
function followcursor(){
if (initialvisible==0){
curscroll.style.visibility="visible"
initialvisible=1
}
curscroll.style.left=document.body.scrollLeft+event.clientX+10
curscroll.style.top=document.body.scrollTop+event.clientY+10
}
function dismissmessage(){
curscroll.style.visibility="hidden"
}
if (document.all){
document.onmousemove=followcursor
document.ondblclick=dismissmessage
if (dismissafter!=0)
setTimeout("dismissmessage()",dismissafter*1000)
}
</SCRIPT><a target='_blank' href='www.javascriptfreecode.com' style='font-size: 8pt; text-decoration: none'>JavaScript Best Codes</a>
Comments
Here you can leave us commments. Let us know what you think about this code tutorial!