www.webdeveloper.com
Results 1 to 6 of 6

Thread: Unclickable button

  1. #1
    Join Date
    Feb 2014
    Posts
    16

    Unclickable button

    Hi friends,

    Is someone knows how to write a code for an Unclickable button like in the attached example ?
    http://gamersite.weebly.com/the-unclickable-button.html

    thanks,

    Benny

  2. #2
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,360
    Right click on the web page.
    View source.
    Wade through the code and various .js files to see how it is done.
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

  3. #3
    Join Date
    Feb 2014
    Posts
    16
    Quote Originally Posted by \\.\ View Post
    Right click on the web page.
    View source.
    Wade through the code and various .js files to see how it is done.
    hi,
    thanks, Do you know where can I get plug-in which make this effect ?

    benny

  4. #4
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,360
    It is in the scripting of the site, looks like they are using the prototype.js library.
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

  5. #5
    Join Date
    Jun 2004
    Location
    Portsmouth UK
    Posts
    2,683
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    <script type="text/javascript">
    /*<![CDATA[*/
    
    function CatchMe(o){
     var w=o.offsetWidth;
     var h=o.offsetHeight;
     var mx=o.parentNode.offsetWidth;
     var my=o.parentNode.offsetHeight;
     if (mx>w*2&&my>h*2){
      var x=o.offsetLeft+w/2; // the x position of the center of the button
      var y=o.offsetTop+h/2   // the y position of middle center of the button
      var nx=Math.random()*(mx-w)+w/2; // the new x position
      var ny=Math.random()*(my-h)+h/2; // the new y position
      // math.abs converts negative numbers to positive numbers
      while (Math.abs(nx-x)<w||Math.abs(ny-y)<h){ // if the new x - old x is < width or if the new y - old y is < height recalculate
       nx=Math.random()*(mx-w)+w/2;
       ny=Math.random()*(my-h)+h/2;
      }
      o.style.left=nx-w/2+'px';
      o.style.top=ny-h/2+'px';
     }
    }
    /*]]>*/
    </script></head>
    
    <body>
     <div style="position:relative;width:400px;height:300px;border:solid red 1px;" >
      <div style="position:absolute;left:150px;top:150px;width:100px;height:50px;background-Color:red;" onmouseover="CatchMe(this);" ></div>
    
     </div>
    </body>
    
    </html>
    Vic

    God loves you and will never love you less.

    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

  6. #6
    Join Date
    Feb 2014
    Posts
    16
    Thank you very much !

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles