Ir para conteúdo
Fórum Script Brasil
  • 0

Imagem Flutuante


Eu o Mister HTML !!!

Pergunta

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 para o comentário
Compartilhar em outros sites

0 respostass a esta questão

Posts Recomendados

Até agora não há respostas para essa pergunta

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,1k
    • Posts
      651,8k
×
×
  • Criar Novo...