Forum Url:
http://qub1test.smfforfree4.comOk, all this code does is place a Draggable calculator at your site...
Oh, and heres a note for Simply Sibyl:
I've found a solution! With your draggable smileys, you needed to upload 2 js files, but i found a solution so you don't have to do so! Just see the code...
Ok, so this is how it looks:
Previeuw (The calculator is at the bottom, and it's draggable)Now, paste this in your headers:
<script language="JavaScript1.2">
var ie=document.all
var ns6=document.getElementById&&!document.all
var dragapproved=false
var z,x,y
function move(e)
{
if (dragapproved)
{
z.style.left=ns6? temp1+e.clientX-x: temp1+event.clientX-x
z.style.top=ns6? temp2+e.clientY-y : temp2+event.clientY-y
return false
}
}
function drags(e)
{
if (!ie&&!ns6)
return
var firedobj=ns6? e.target : event.srcElement
var topelement=ns6? "HTML" : "BODY"
while (firedobj.tagName!=topelement&&firedobj.className!="drag")
{
firedobj=ns6? firedobj.parentNode : firedobj.parentElement
}
if (firedobj.className=="drag")
{
dragapproved=true
z=firedobj
temp1=parseInt(z.style.left+0)
temp2=parseInt(z.style.top+0)
x=ns6? e.clientX: event.clientX
y=ns6? e.clientY: event.clientY
document.onmousemove=move
return false
}
}
document.onmousedown=drags
document.onmouseup=new Function("dragapproved=false")
</script>
<style type='text/css'>.drag{position:relative;cursor:crosshair}</style>
And this in your Footers:
<div id="calc" class="drag">
<form name="calculator">
<table border="3" cellpadding="0" bordercolor="black" bgcolor="#CCFFCC" cellspacing="1" width="150">
<tr>
<td>
<input type="text" size="20" length="19" value="" name="ans" style="background:black;color:lime;">
</td>
</tr>
</table>
<table border="3" cellpadding="2" bordercolor="black" cellspacing="2" width="150" bgcolor="#CCFFCC">
<tr>
<td align="center">
<input type="button" value=" 7 " name="seven" onMouseDown="document.calculator.ans.value+='7'">
</td>
<td align="center">
<input type="button" value=" 8 " name="eight" onClick="document.calculator.ans.value+='8'">
</td>
<td align="center">
<input type="button" value=" 9 " name="nine" onClick="document.calculator.ans.value+='9'">
</td>
<td align="center">
<input type="button" value=" / " name="divide" onClick="document.calculator.ans.value+='/'">
</td>
</tr>
<tr>
<td align="center">
<input type="button" value=" 4 " name="four" onClick="document.calculator.ans.value+='4'">
</td>
<td align="center">
<input type="button" value=" 5 " name="five" onClick="document.calculator.ans.value+='5'">
</td>
<td align="center">
<input type="button" value=" 6 " name="six" onClick="document.calculator.ans.value+='6'">
</td>
<td align="center">
<input type="button" value=" * " name="multiply" onClick="document.calculator.ans.value+='*'">
</td>
</tr>
<tr>
<td align="center">
<input type="button" value=" 1 " name="one" onClick="document.calculator.ans.value+='1'">
</td>
<td align="center">
<input type="button" value=" 2 " name="two" onClick="document.calculator.ans.value+='2'">
</td>
<td align="center">
<input type="button" value=" 3 " name="three" onClick="document.calculator.ans.value+='3'">
</td>
<td align="center">
<input type="button" value=" - " name="subtract" onClick="document.calculator.ans.value+='-'">
</td>
</tr>
<tr>
<td align="center">
<input type="button" value=" C " name="clear" onClick="document.calculator.ans.value=''">
</td>
<td align="center">
<input type="button" value=" 0 " name="zero" onClick="document.calculator.ans.value+='0'">
</td>
<td align="center">
<input type="button" value=" = " name="equal" onClick="document.calculator.ans.value=eval(document.calculator.ans.value)">
</td>
<td align="center">
<input type="button" value=" + " name="add" onClick="document.calculator.ans.value+='+'">
</td>
</tr>
</table>
</form>
</div>
Ok, that was it (not editable, it's a wonder! lol )!- Qub1