Tak jak w temacie.
W akcji na: http://www.dan080...?page_id=2
W subheader.php po:
<script type='text/javascript' src='".INCLUDES."jscript.js'></script>
Dodajemy:
<SCRIPT LANGUAGE=\"JavaScript\">
<!--
<!-- JavaScript Example, freeware -->
<!-- -->
<!-- Copyright (c) 1998 by Wojciech Wysznacki -->
<!-- E-mail: -->
<!-- WWW : http://www.polbox.com/w/woytek -->
<!-- -->
var wynik=0, op=0, nowe=0, nowe2=0, done=1, oset=0, kropka, temp;
function reset(value)
{
document.form1.ekran.value = value;
wynik = 0,
op = 0,
nowe = 0,
nowe2 = 0;
done = 1;
oset = 0;
}
function wspolna(new_temp)
{
kropka = 1;
if(nowe || done) {
nowe = 0;
done = 0;
temp = new_temp;
}
{
if (temp.indexOf(".")!=-1) {
kropka=0;
}
}
}
function button(ktory,ktory2)
{
temp = document.form1.ekran.value;
if(ktory2=='.') {
wspolna('0');
if(kropka==1) {
temp += ktory2;
document.form1.ekran.value = temp;
oset = 0;
}
}
if(ktory>=0 && ktory<=9) {
wspolna('');
if(temp==0 && kropka==1) temp='';
temp += ktory;
document.form1.ekran.value = temp;
oset = 1;
}
if(ktory2=='-' || ktory2=='+' || ktory2=='/' || ktory2=='*') {
if(nowe) op = ktory2
else {
if(!nowe2) {
op = ktory2;
wynik = temp;
nowe2=1;
}
else {
wynik = eval(wynik + op + temp);
op = ktory2;
document.form1.ekran.value = wynik;
}
oset=0;
nowe = 1;
}
}
if(ktory2=='1/x' ) { wynik = eval(1 / temp) ; reset(wynik); }
if(ktory2=='sqrt') { wynik = Math.sqrt(temp); reset(wynik); }
if(ktory2=='exp' ) { wynik = Math.exp(temp) ; reset(wynik); }
if(ktory2=='+/-') document.form1.ekran.value = eval(-temp);
if(ktory2=='=' && oset && op!='0') reset(eval(wynik + op + temp));
if (ktory2=='C') reset(0);
if(document.form1.ekran.value[0] == '.')
document.form1.ekran.value = '0' + document.form1.ekran.value;
}
//-->
</SCRIPT>
Na stronie informacyjnej w treści wpisujemy:
<form name="form1">
<TABLE bgcolor="#430086"><TR><TD>
<TABLE BORDER=1 cellspacing=5 cellpadding=0 bgcolor="#430086">
<TR align=center>
<TD colspan=5><input type="text" name="ekran" value="0"></TD>
</TR>
<TR align=center>
<TD colspan=4><B><FONT COLOR="#FFFFFF">Kalkulator</FONT></B></TD>
<TD ><input type="button" name="C" value=" C " onclick="button(11,'C')"></TD>
</TR>
<TR align=center>
<TD><input type="button" name="7" value=" 7 " onclick="button(7 ,'')"></TD>
<TD><input type="button" name="8" value=" 8 " onclick="button(8 ,'')"></TD>
<TD><input type="button" name="9" value=" 9 " onclick="button(9 ,'')"></TD>
<TD><input type="button" name="/" value=" / " onclick="button(11,'/')"></TD>
<TD><input type="button" name="sqrt" value="sqrt" onclick="button(11,'sqrt')"></TD>
</TR>
<TR align=center>
<TD><input type="button" name="4" value=" 4 " onclick="button(4,'')"></TD>
<TD><input type="button" name="5" value=" 5 " onclick="button(5,'')"></TD>
<TD><input type="button" name="6" value=" 6 " onclick="button(6,'')"></TD>
<TD><input type="button" name="*" value=" * " onclick="button(11,'*')"></TD>
<TD><input type="button" name="exp" value="exp" onclick="button(11,'exp')"></TD>
</TR>
<TR align=center>
<TD><input type="button" name="1" value=" 1 " onclick="button(1,'')"></TD>
<TD><input type="button" name="2" value=" 2 " onclick="button(2,'')"></TD>
<TD><input type="button" name="3" value=" 3 " onclick="button(3,'')"></TD>
<TD><input type="button" name="-" value=" - " onclick="button(11,'-')"></TD>
<TD><input type="button" name="1/x" value="1/x " onclick="button(11,'1/x')"></TD>
</TR>
<TR align=center>
<TD><input type="button" name="0" value=" 0 " onclick="button(0,'')"></TD>
<TD><input type="button" name="+/-" value=" +/- " onclick="button(11,'+/-')"></TD>
<TD><input type="button" name="." value=" , " onclick="button(11,'.')"></TD>
<TD><input type="button" name="+" value=" + " onclick="button(11,'+')"></TD>
<TD><input type="button" name="=" value=" = " onclick="button(11,'=')"></TD>
</TR>
</TABLE>
</TD></TR></TABLE>
</form>
Zapożyczony z http://www.swmare...
Edytowane przez Szapko dnia 12.07.2008 04:19:50
|