Jump to content
Fórum Script Brasil
  • 0

Imagem Flutuante


Eu o Mister HTML !!!
 Share

Question

Imagem flutuante

uma imagem que pode ser arrastada para qualquer lugar

coloque entre as tags <head> e </head>:
<script language="JavaScript" type="text/javascript">
  var dragswitch=0 
  var nsx
  var nsy
  var nstemp
  function drag_dropns(name){
  temp=eval(name)
  temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
  temp.onmousedown=gons
  temp.onmousemove=dragns
  temp.onmouseup=stopns 
  }
  function gons(e){
  temp.captureEvents(Event.MOUSEMOVE)
  nsx=e.x
  nsy=e.y
  }
  function dragns(e){
  if (dragswitch==1){
  temp.moveBy(e.x-nsx,e.y-nsy)
  return false 
  }
  }
  function stopns(){
  temp.releaseEvents(Event.MOUSEMOVE)
  }
  var dragapproved=false
  function drag_dropie(){
  if (dragapproved==true){
  document.all.showimage.style.pixelLeft=tempx+event.clientX-iex
  document.all.showimage.style.pixelTop=tempy+event.clientY-iey
  return false
  }
  }
  function initializedragie(){
  iex=event.clientX
  iey=event.clientY
  tempx=showimage.style.pixelLeft
  tempy=showimage.style.pixelTop
  dragapproved=true
  document.onmousemove=drag_dropie
  }
  if (document.all){
  document.onmouseup=new Function("dragapproved=false") 
  }
  function hidebox(){
  if (document.all)
  showimage.style.visibility="hidden"
  else if (document.layers)
  document.showimage.visibility="hide"
  }
  </script>
coloque entre as tags <body> e </body>:
<DIV id="showimage" style="LEFT: 50px; WIDTH: 50px; POSITION: absolute; TOP: 1px">
<TABLE cellSpacing=0 cellPadding=0 width="50" bgColor="transparent" border=0>
  <TBODY>
  <TR>
    <TD width="100%">
      <TABLE height=36 cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>

        <TR>
          <TD align="center"
         onmousedown=initializedragie() style="CURSOR: hand" 
            width="100%" style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px" 
          width="100%" bgColor="Transparent" colSpan=2><ILAYER width="100%"><LAYER 
            onmouseover=dragswitch=1;drag_dropns(showimage) 
            onmouseout=dragswitch=0 width="100%"><SMALL> <img src="No_Stress_PC.jpg" Height="45" Width="45" border="0"> 
<br>
<input type="text" style="background-color: transparent; color: cyan; border-top: 0px; border-bottom: 0px; border-right: 0px; border-left: 0px; text-align: center" size="6" ></SMALL> </LAYER></ILAYER><BR>
</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIVPT>

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      150.9k
    • Total Posts
      648.8k
×
×
  • Create New...