Jest to forum na którym można znaleźść m.in. jak stworzyć stronę internetową.
HeadAdmin
Dziś przygotowałem dla was kilkanaście skryptów w Javascript
Spoiler:
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=WINDOWS-1250">
<script LANGUAGE="Javascript">
<!--
function Oblicz(Obiekt) {
Obiekt.Wynik.value = eval(Obiekt.expr.value)
}
// -->
</SCRIPT>
</HEAD>
<BODY><CENTER>
<form name="Kalkulator">
<pre>
Wyrażenie
<BR><input type="text" name="expr" size="20">
Wynik
<input type="text" name="Wynik" size="20">
<input type="button" name="Licz"
value=" Oblicz "
onclick="Oblicz(this.form)"
</pre>
</form>
</BODY>
</HTML>
Spoiler:
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=WINDOWS-1250">
<script language="javascript">
<!-- W3e JAVAScript Preset/Date
var DDMMYY =0
var MMDDYY =1
function getdate(mode)[/color]
{
var now = new Date();
var dayNr = ((now.getDate()<10) ? "0" : "")+ now.getDate();
if (mode==DDMMYY)
var MonthDayYear =(dayNr+"/"+(now.getMonth()+1)+"/"+now.getYear());
else
var MonthDayYear =((now.getMonth()+1)+"/"+dayNr+"/"+now.getYear());
return MonthDayYear;
}
function gettime()
{
var now = new Date();
var ampm = (now.getHours() >= 12) ? " P.M." : " A.M."
var hours = now.getHours();
hours = ((hours > 12) ? hours - 12 : hours);
var minutes = ((now.getMinutes() < 10) ? ":0" : ":") + now.getMinutes();
var seconds = ((now.getSeconds() < 10) ? ":0" : ":") + now.getSeconds();
var TimeValue =(" " + hours + minutes + seconds + " " + ampm);
return TimeValue;
}//-->
</script>
</HEAD>
<BODY><CENTER>
<script language="javascript">document.write(getdate(DDMMYY));</script>
</BODY>
</HTML>
Spoiler:
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=WINDOWS-1250">
</HEAD>
<BODY><CENTER>
<script Language="JavaScript">
<!-- start hide
document.writeln("Widze, że używasz " + navigator.appName + " (" + navigator.appCodeName + ") " + navigator.appVersion + "<BR>");
// end hide -->
</SCRIPT>
</BODY>
</HTML>
Spoiler:
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=WINDOWS-1250">
<script language="JavaScript1.2">
<!--
var bookmarkurl=document.location
var bookmarktitle=document.title
function addbookmark(){
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle)
}
// -->
</SCRIPT>
</HEAD>
<BODY><CENTER>
<FORM>
<INPUT TYPE="BUTTON" NAME="BTN_Bookmark" VALUE="Dodaj do ulubionych!" OnClick="javascript:addbookmark()">
</FORM>
</BODY>
</HTML>
Spoiler:
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=WINDOWS-1250">
<script language="JavaScript1.2">
<!--
function DoPrinting(){
if (!window.print){
alert("You must have Netscape 4.x or MSIE5,\n in order to use this print button!")
return
}
window.print()
}
//-->
</script>
</HEAD>
<BODY><CENTER>
<FORM>
<INPUT TYPE="BUTTON" NAME="BTN_PrintPage" VALUE="Kliknij, aby wydrukować tą stronę" OnClick="javascript:DoPrinting()">
</FORM>
</BODY>
</HTML>
Spoiler:
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=WINDOWS-1250">
</HEAD>
<BODY><CENTER>
<script LANGUAGE="JavaScript">
<!--
document.write("<center><font size=+1><b>")
now = new Date()
if (now.getDay() == 5)
document.write("Wspaniale! To już piątek!")
if (now.getDay() == 6)
document.write("Hurra! Weekend!")
if (now.getDay() == 0)
document.write("Hurra! Weekend!")
if (now.getDay() == 1)
document.write("Dzisiaj mamy poniedziałek. To będzie dobry tydzień, mam nadzieję ...")
if (now.getDay() == 2)
document.write("Jest wtorek. Poniedziałek mamy na szczęście za sobą.")
if (now.getDay() == 3)
document.write("Środa, czy Twój tydzień jest również udany?")
if (now.getDay() == 4)
document.write("To już czwartek, weekend już tuż tuż...")
document.write("</b></center></font>")
//-->
</SCRIPT>
</BODY>
</HTML>
Spoiler:
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=WINDOWS-1250">
</HEAD>
<BODY><CENTER>
<script LANGUAGE="Javascript">
<!--
var urodz = new Date("March 3, 2010");
var now = new Date();
var ile = now.getTime() - urodz.getTime();
var dni = Math.floor(ile / (1000 * 60 * 60 * 24));
if (dni > 0)
document.write(dni + " dni mineło od roku 2010")
else
document.write("This will happen in future");
// --></SCRIPT>
</BODY>
</HTML>
Spoiler:
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=WINDOWS-1250">
</HEAD>
<BODY><CENTER>
<script LANGUAGE="JavaScript">
<!-- Hide from non-Javascript browsers
d = new Date();
hour = d.getHours();
if(hour < 5)
{
document.write("Noc");
}
else
if(hour < 8)
{
document.write("Wczesny ranek");
}
else
if(hour < 12)
{
document.write("Popołudnie");
}
else
if(hour < 18)
{
document.write("Zmierzch");
}
else
{
document.write("Wieczór");
}
document.write("<P>");
//-->
</SCRIPT>
</BODY>
</HTML>
Spoiler:
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=WINDOWS-1250">
<script language="JavaScript">
<!--
Months = new Array(12);
Months[0] = "Styczeń";
Months[1] = "Luty";
Months[2] = "Marzec";
Months[3] = "Kwiecien";
Months[4] = "Maj";
Months[5] = "Czerwiec";
Months[6] = "Lipiec";
Months[7] = "Sierpień";
Months[8] = "Wrzesień";
Months[9] = "Październik";
Months[10] = "Listopad";
Months[11] = "Grudzień";
function PadSpaces(TheString)
{
var Spaces = " ";
len = Math.round((9 - TheString.length)/2);
return Spaces.substring(0,len) + TheString;
}
function NumLeapYears(StartYear, EndYear)
{
var LeapYears, i;
if (EndYear >= StartYear){
for(LeapYears = 0; StartYear <= EndYear; StartYear++)
if (IsLeapYear(StartYear)) LeapYears++;
}else{
for(LeapYears = 0; EndYear <= StartYear; EndYear++)
if (IsLeapYear(EndYear)) LeapYears++;
}
return LeapYears;
}
function IsLeapYear(Year)
{
if(Math.round(Year/4) == Year/4){
if(Math.round(Year/100) == Year/100){
if(Math.round(Year/400) == Year/400)
return true;
else return false;
}else return true;
}
return false;
}
function Trim(TheString)
{
var len;
len = TheString.length;
while(TheString.substring(0,1) == " "){
TheString = TheString.substring(1, len);
len = TheString.length;
}
while(TheString.substring(len-1, len) == " "){
TheString = TheString.substring(0, len-1);
len = TheString.length;
}
return TheString;
}
function DetermineMonthIdx()
{
var i, month, month_s, len;
month = Trim(document.calform.elements[4].value);
len = month.length;
for( i = 0; i <12; i++){
month_s = Months[i].substring(0,len);
if (month_s.toUpperCase() == month.toUpperCase())
return (i);
}
return -1;
}
function FindNewYearStartingDay(Year)
{
var LeapYears, Years, Day;
LeapYears = NumLeapYears(1995, Year);
if (Year >=1995)
Years = (Year -1995)+LeapYears;
else Years = (Year -1995)-LeapYears;
if (Year >=1995)
Day = Math.round(((Years/7 - Math.floor(Years/7))*7)+.1);
else Day = Math.round(((Years/7 - Math.ceil(Years/7))*7)-.1);
if (Year >=1995){
if(IsLeapYear(Year)) Day--;
}else Day += 7;
if(Day < 0) Day = 6;
if(Day > 6) Day = 0;
return Day;
}
function FindNumDaysInMonth(Year, Month)
{
if(Month == 1){
if(IsLeapYear(Year)) return 29;
else return 28;
}else{
if(Month >6) Month++;
if(Month/2 == Math.round(Month/2)) return 31;
}
return 30;
}
function FindMonthStartDay(NewYearDay, Year, Month)
{
var MonthStartDay;
AddArray = new Array(12);
AddArray[0]=0;AddArray[1]=3;AddArray[2]=3;AddArray[3]=6;
AddArray[4]=1;AddArray[5]=4;AddArray[6]=6;AddArray[7]=2;
AddArray[8]=5;AddArray[9]=0;AddArray[10]=3;AddArray[11]=5;
MonthStartDay = NewYearDay + AddArray[Month];
if(IsLeapYear(Year) && (Month ) > 1) MonthStartDay ++;
if (MonthStartDay > 6) MonthStartDay -= 7;
return MonthStartDay;
}
function FillCalendar()
{
var Year, Month, Midx, NewYearDay, MonthStartDay;
var NumDaysInMonth, i, t;
Year = parseFloat(document.calform.elements[1].value);
Month = document.calform.elements[4].value;
Midx = DetermineMonthIdx();
if (Midx == -1){
alert ("Can't recognize that month");
return;
}
NewYearDay = FindNewYearStartingDay(Year);
MonthStartDay = FindMonthStartDay(NewYearDay, Year, Midx);
NumDaysInMonth = FindNumDaysInMonth(Year, Midx);
for(i = 6; i < 43; i++){
t = i-5-MonthStartDay;
if ( t >= 1 && t <= NumDaysInMonth)
document.calform.elements[i].value =t;
else document.calform.elements[i].value = "";
}
}
function IncDecYear(val)
{
var valNum = parseInt(val);
var valNum2 = parseInt(document.calform.elements[1].value)
document.calform.elements[1].value = valNum2 + valNum;
FillCalendar()
}
function IncDecMonth(val)
{
var valNum = parseInt(val);
var Midx = DetermineMonthIdx();
Midx += valNum;
if(Midx > 11) Midx = 0;
if(Midx < 0) Midx = 11;
document.calform.elements[4].value = PadSpaces(Months[Midx]);
FillCalendar()
}
// -->
</script>
</HEAD>
<BODY><CENTER>
<table border=1 bgcolor="#000000"><tr><td align=center>
<table border=0 cellspacing=0>
<form name="calform">
<tr><td align=center bgcolor="#000000"><input type=button value="<<" onClick="IncDecYear(-1)"></td>
<th bgcolor="#aaaaaa" colspan=5 align=center><input size=4 type=text value="1993"></th>
<td align=center bgcolor="#000000"><input type=button value=">>" onClick="IncDecYear(1)"></td></tr>
<tr><td align=center bgcolor="#000000"><input type=button value="<<" onClick="IncDecMonth(-1)"></td>
<th bgcolor="#aaaaaa" colspan=5 align=center><input size=9 type=text value=" January "></th>
<td align=center bgcolor="#000000"><input type=button value=">>" onClick="IncDecMonth(1)"></td></tr>
<tr><th bgcolor="#ffcccc">Sun</td>
<th bgcolor="#ccccff">Mon</td>
<th bgcolor="#ccccff">Tue</td>
<th bgcolor="#ccccff">Wed</td>
<th bgcolor="#ccccff">Thu</td>
<th bgcolor="#ccccff">Fri</td>
<th bgcolor="#ccccff">Sat</td></tr>
<tr><td bgcolor="#ffcccc"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td></tr>
<tr><td bgcolor="#ffcccc"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td></tr>
<tr><td bgcolor="#ffcccc"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td></tr>
<tr><td bgcolor="#ffcccc"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td></tr>
<tr><td bgcolor="#ffcccc"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td>
<td bgcolor="#ccccff" ><input type=text size=2></td></tr>
<tr><td bgcolor="#ffcccc"><input type=text size=2></td>
<td bgcolor="#ccccff"><input type=text size=2></td>
<td bgcolor="#aaaaaa" colspan=5><input type=text></td></tr>
</form>
</table>
</td></tr></table>
<script language="JavaScript">
<!--
myDate = new Date();
var Month = parseInt(myDate.getMonth());
document.calform.elements[1].value = 1900 + myDate.getYear();
document.calform.elements[4].value = PadSpaces(Months[Month]);
document.calform.elements[43].value = "Today is: " +
myDate.getDate() + " " + Months[Month].substring(0,3)
+ ", " + (1900 + myDate.getYear());
FillCalendar();
// -->
</script>
</BODY>
</HTML>
Spoiler:
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=WINDOWS-1250">
<!-- fragment do sekcji HEAD -->
<script LANGUAGE="JavaScript">
<!--
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>
</HEAD>
<BODY><CENTER>
<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>
[color="#fffacd"] <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>
</BODY>
</HTML>
A teraz podam wam po kolei nazwy skryptów
1. Prosty Kalkulator
2. Aktualna Data
3. Detekcja Przeglądarki
4.Dodanie do ulubionych
5. Drukowanie strony
6. Dzień tygodnia
7. Ile dni minęło od roku
8. Pora dnia
9. Kalendarz
10. Zaawansowany Kalkulator
Offline