Siyaset Forum

Siyaset Forum (https://www.siyasetforum.com.tr/index.php)
-   Javascript (https://www.siyasetforum.com.tr/forumdisplay.php?f=399)
-   -   Sallanan Buton Kodu (https://www.siyasetforum.com.tr/showthread.php?t=55449)

OTTOMAN 02-10-2009 14:27

Sallanan Buton Kodu
 
Kod:


<script language="javascript">
pos = 15;
TO = null;
function shake_funct2(object,speed)
{
  obj = eval(object)
  txt = clear_space(obj.value);
  if (pos == 15)
  {
  txt = txt + "  ";
  pos = -15;
  }
  else
  {
  txt = "  " + txt;
  pos = 15;
  } 
  obj.value = txt;
  obj.style.width = parseInt(obj.style.width) + pos;
  obj = object
  sp = speed
  TO = setTimeout("shake_funct2(obj,sp)",speed);
}
function clear_space(text)
{
 while (text.substring(0,1) == " ")
 {
  text = text.substring(1,text.length);
 }
 while(text.substring(text.length-1,text.length) == " ")
 {
  text = text.substring(0,text.length-1);
 }
 return text;
}
function end_shake_funct2(object)
{
  clearTimeout(TO);
  obj = eval(object);
  txt = clear_space(obj.value);
  obj.value = txt;
  //alert(pos);
  if (pos == -15)
  {
  obj.style.width = parseInt(obj.style.width) +15;
  }
  pos = 15
}
</script>
<html>
<center>
<form name=myform2>
<table border=0>
<tr><td>
</td>
<td align=center width=160>
<input type=button value = "Yavaş" style="font-size:10;width:150" onmouseover="shake_funct2(this,100)" onmouseout="end_shake_funct2(this)">
</td></tr>
<tr><td>
</td>
<td  align=center width=160>
<input type=button value = "Hızlı" style="font-size:10;width:150" onmouseover="shake_funct2(this,50)" onmouseout="end_shake_funct2(this)">
</td></tr>
</Table>
</form>



All times are GMT +3. The time now is 00:06.

Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Siyaset Forum 2007-2025