Органайзер с возможностью записи заметок по дате на языке javascript

Автор работы: Пользователь скрыл имя, 17 Декабря 2013 в 08:46, курсовая работа

Описание работы

Гипертекстовая информационная система состоит из множества информационных узлов, множества гипертекстовых связей, определенных на этих узлах и инструментах манипулирования узлами и связями. Технология World Wide Web - это технология ведения гипертекстовых распределенных систем в Internet, и, следовательно, она должна соответствовать общему определению таких систем. Это означает, что все перечисленные выше компоненты гипертекстовой системы должны быть и в Web.

Содержание работы

Введение 3
Основы JavaScript 5
Описание проектного решения 9
Заключение 25
Список литературы 26
Приложение 27

Файлы: 1 файл

СОЗДАНИЕ ОРГАНАЙЗЕРА НА ЯЗЫКЕ JAVASCRIPT .docx

— 735.64 Кб (Скачать файл)

<img src="x_5b25852a.jpg" width=500 height=500 hspace=5 vspace=0 align=left><p>

<BR>

<SCRIPT LANGUAGE="JavaScript">

current_date = new Date()

document.write("<font size=3 color=#191970 face=Bookman Old Style><p><i><p align=center>Текущая дата:</i></front> " + current_date + ".<p></p>")

</SCRIPT>

<script LANGUAGE="Javascript">

function setCookie(name, value, expires, path, domain, secure) {

 

var curCookie = name + "=" + escape(value) +

 

((expires) ? "; expires=" + expires.toGMTString() : "") +

 

((path) ? "; path=" + path : "") +

 

((domain) ? "; domain=" + domain : "") +

 

((secure) ? "; secure" : "")

 

if (!caution || (name + "=" + escape(value)).length <= 4000)

 

document.cookie = curCookie

 

else

 

if (confirm("Cookie превышает 4KB и будет вырезан !"))

 

document.cookie = curCookie

 

}

 

function getCookie(name) {

 

var prefix = name + "="

 

var cookieStartIndex = document.cookie.indexOf(prefix)

 

if (cookieStartIndex == -1)

 

return null

 

var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)

 

if (cookieEndIndex == -1)

 

cookieEndIndex = document.cookie.length

 

return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))

 

}

 

function deleteCookie(name, path, domain) {

 

if (getCookie(name)) {

 

document.cookie = name + "=" +

 

((path) ? "; path=" + path : "") +

 

((domain) ? "; domain=" + domain : "") +

"; expires=Thu, 01-Jan-70 00:00:01 GMT"

}

}

 

function fixDate(date) {

 

var base = new Date(0)

 

var skew = base.getTime()

 

if (skew > 0)

 

date.setTime(date.getTime() - skew)

}

 

function initCookie(monthName) {

// initializes cookie with the following format:

var text = ""

 

for (var i = 1; i <= 31; ++i) {

 

text += "^" + i + "^"

}

var now = new Date()

 

fixDate(now)

 

now.setTime(now.getTime() + 1000 * 60 * 60 * 24 * 31)

 

setCookie(monthName + "Calendar", text, now)

}

 

function getSpecificReminder(num, monthName) {

 

var prefix = "^" + num + "^"

 

var totalCookie = getCookie(monthName + "Calendar")

 

var startIndex = totalCookie.indexOf(prefix, 0)

 

var startData = totalCookie.indexOf("^", startIndex + 1) + 1

 

if (num == 31)

 

var endData = totalCookie.length

 

else

 

var endData = totalCookie.indexOf("^", startData)

return totalCookie.substring(startData, endData)

 

}

 

function setSpecificReminder(num, monthName, newValue) {

 

var prefix = "^" + num + "^"

 

var totalCookie = getCookie(monthName + "Calendar")

 

var startIndex = totalCookie.indexOf(prefix, 0)

 

var startData = totalCookie.indexOf("^", startIndex + 1) + 1

if (num == 31)

 

var endData = totalCookie.length

 

else

 

var endData = totalCookie.indexOf("^", startData)

 

var now = new Date()

 

fixDate(now)

 

 

now.setTime(now.getTime() + 1000 * 60 * 60 * 24 * 31)

 

setCookie(monthName + "Calendar", totalCookie.substring(0, startData) + newValue + totalCookie.substring(endData, totalCookie.length), now)

 

}

 

function getInput(num, monthName) {

 

if (!getCookie(monthName + "Calendar"))

 

initCookie(monthName)

 

var newValue = prompt("Введите запись соответствующей данной дате:", getSpecificReminder(num, monthName))

 

if (newValue) // user did not cancel

 

setSpecificReminder(num, monthName, newValue)

 

}

 

 

 

function getTime() {

var now = new Date()

 

var hour = now.getHours()

 

var minute = now.getMinutes()

 

now = null

 

var ampm = ""

 

if (hour >= 12) {

 

hour -= 12

 

ampm = "PM"

} else

 

ampm = "AM"

 

hour = (hour == 0) ? 12 : hour

 

 

if (minute < 10)

 

minute = "0" + minute // do not parse this number!

 

return hour + ":" + minute + " " + ampm

 

}

 

function leapYear(year) {

 

if (year % 4 == 0) // basic rule

 

return true // is leap year

 

return false // is not leap year

 

}

 

{

 

var ar = new Array(12)

 

ar[0] = 31 // January

 

ar[1] = (leapYear(year)) ? 29 : 28 // February

 

ar[2] = 31 // March

 

ar[3] = 30 // April

 

ar[4] = 31 // May

 

ar[5] = 30 // June

 

ar[6] = 31 // July

 

ar[7] = 31 // August

 

ar[8] = 30 // September

 

ar[9] = 31 // October

 

ar[10] = 30 // November

 

ar[11] = 31 // December

 

return ar[month]

 

}

function getMonthName(month) {

 

// create array to hold name of each month

 

var ar = new Array(12)

 

ar[0] = "ЯНВАРЬ"

 

ar[1] = "ФЕВРАЛЬ"

 

ar[2] = "МАРТ"

 

ar[3] = "АПРЕЛЬ"

 

ar[4] = "МАЙ"

 

ar[5] = "ИЮНЬ"

 

ar[6] = "ИЮЛЬ"

 

ar[7] = "АВГУСТ"

 

ar[8] = "СЕНТЯБРЬ"

 

ar[9] = "ОКТЯБРЬ"

 

ar[10] = "НОЯБРЬ"

 

ar[11] = "ДЕКАБРЬ"

 

return ar[month]

 

}

 

function setCal() {

 

// standard time attributes

 

var now = new Date()

 

var year = now.getYear()

 

var month = now.getMonth()

 

var monthName = getMonthName(month)

 

var date = now.getDate()

 

now = null

 

var firstDayInstance = new Date(year, month, 1)

 

var firstDay = firstDayInstance.getDay()

 

firstDayInstance = null

 

var days = getDays(month, year)

 

drawCal(firstDay + 1, days, date, monthName, 1900 + year)

 

}

 

function drawCal(firstDay, lastDate, date, monthName, year) {

 

var headerHeight = 35 // height of the table's header cell

var border = 0 // 3D height of table's border

var cellspacing = 0 // width of table's border

var headerColor = "Black" // color of table's header

var headerSize = "+2" // size of tables header font

var colWidth = 45 // width of columns in table

var dayCellHeight = 15 // height of cells containing days of the week

var dayColor = "White" // color of font representing week days

var cellHeight = 25 // height of cells representing dates in the calendar

var todayColor = "red" // color specifying today's date in the calendar

var timeColor = "Black" // color of font representing current time

var dayCellcolor="0066ff"

var monthColor="00ccff"

 

var text = "" // initialize accumulative variable to empty string

 

text += '<CENTER>'

 

text += '<TABLE BORDER=' + border + ' CELLSPACING=' + cellspacing + '>' // table settings

 

text +=  '<TH COLSPAN=7 HEIGHT=' + headerHeight + ' BGCOLOR='+ monthColor +'>' // create table header cell

 

text +=   '<FONT COLOR="' + headerColor + '" SIZE=' + headerSize + '>' // set font for table header

 

text +=    monthName + ' ' + year

 

text +=   '</FONT>' // close table header's font settings

 

text +=  '</TH>' // close header cell

 

 

var openCol = '<TD align=right WIDTH=' + colWidth + ' HEIGHT=' + dayCellHeight + ' BGCOLOR='+ dayCellcolor +'>'

 

openCol += '<FONT SIZE=-1 COLOR="' + dayColor + '">'

 

var closeCol = '</FONT></TD>'

 

var weekDay = new Array(7)

 

weekDay[0] = "Вс"

 

weekDay[1] = "Пн"

 

weekDay[2] = "Вт"

 

weekDay[3] = "Ср"

 

weekDay[4] = "Чт"

 

weekDay[5] = "Пт"

 

weekDay[6] = "Сб"

 

 

text += '<TR ALIGN="center" VALIGN="center">'

 

for (var dayNum = 0; dayNum < 7; ++dayNum) {

 

text += openCol + weekDay[dayNum] + closeCol

 

}

 

text += '</TR>'

 

var digit = 1

 

var curCell = 1

 

 

 

for (var row = 1; row <= Math.ceil((lastDate + firstDay - 1) / 7); ++row) {

 

text += '<TR ALIGN="right" VALIGN="top">'

 

for (var col = 1; col <= 7; ++col) {

 

if (digit > lastDate)

 

break

 

if (curCell < firstDay) {

 

text += '<TD></TD>';

 

curCell++

 

} else {

 

if (digit == date) { // current cell represent today's date

 

text += '<TD HEIGHT=' + cellHeight + ' BGCOLOR="#00FFFF">'

 

text += '<FONT COLOR="' + todayColor + '">'

 

text += '<A HREF="javascript:getInput(' + digit + ', \'' + monthName + '\')" onMouseOver="window.status = \'Записать или прочесть запись за ' + monthName + ' ' + digit + '\'; return true" ><FONT SIZE=-1 COLOR="' + todayColor + '">' + digit + '</FONT></A>'

 

text += '<BR>'

 

text += '<FONT COLOR="' + timeColor + '" SIZE=2>'

 

text += '<CENTER>' + getTime() + '</CENTER>'

 

text += '</FONT>'

 

text += '</TD>'

 

} else

 

text += '<TD HEIGHT=' + cellHeight + ' BGCOLOR="#C0C0C0"><FONT SIZE=-1><A HREF="javascript:getInput(' + digit + ', \'' + monthName + '\')" onMouseOver="window.status = \'Записать или прочесть запись за ' + monthName + ' ' + digit + '\'; return true">' + digit + '</A></FONT></TD>'

 

digit++

 

}

 

}

 

text += '</TR>'

 

}

 

 

text += '</TABLE>'

 

text += '</CENTER>'

 

 

document.write(text)

 

}

 

setCal()

 

</script >

 

<script language="JavaScript">

<!--

var now = new Date()

fixDate(now)

now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000)

var visits = getCookie("counter")

if (!visits)

visits = 1

else

visits = parseInt(visits) + 1

setCookie("counter", visits, now)

document.write("Вы были здесь " + visits + " раз(а).")

//-->

</script>

 

 

<font size=4 color=#191970 face=Bookman Old Style ><b><p align=right>Выбрать фон страницы</p></b></font>

<BR>

<script LANGUAGE="Javascript">

 

var no = 50; // snow number

var speed = 10; // smaller number moves the snow faster

var snowflake = "snow.gif";

 

var ns4up = (document.layers) ? 1 : 0;  // browser sniffer

var ie4up = (document.all) ? 1 : 0;

var dx, xp, yp;    // coordinate and position variables

var am, stx, sty;  // amplitude and step variables

var i, doc_width = 800, doc_height = 600;

if (ns4up) {

doc_width = self.innerWidth;

doc_height = self.innerHeight;

} else if (ie4up) {

doc_width = document.body.clientWidth;

doc_height = document.body.clientHeight;

}

dx = new Array();

xp = new Array();

yp = new Array();

am = new Array();

stx = new Array();

sty = new Array();

for (i = 0; i < no; ++ i) {

dx[i] = 0;                        // set coordinate variables

xp[i] = Math.random()*(doc_width-50);  // set position variables

yp[i] = Math.random()*doc_height;

am[i] = Math.random()*20;         // set amplitude variables

stx[i] = 0.02 + Math.random()/10; // set step variables

sty[i] = 0.7 + Math.random();     // set step variables

if (ns4up) {                      // set layers

if (i == 0) {

document.write("<layer name=\"dot"+ i +"\" left=\"15\" ");

document.write("top=\"15\" visibility=\"show\"><img src=\"");

document.write(snowflake + "\" border=\"0\"></layer>");

} else {

document.write("<layer name=\"dot"+ i +"\" left=\"15\" ");

document.write("top=\"15\" visibility=\"show\"><img src=\"");

document.write(snowflake + "\" border=\"0\"></layer>");

}

} else if (ie4up) {

if (i == 0) {

document.write("<div id=\"dot"+ i +"\" style=\"POSITION: ");

document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");

document.write("visible; TOP: 15px; LEFT: 15px;\"><img src=\"");

document.write(snowflake + "\" border=\"0\"></div>");

} else {

document.write("<div id=\"dot"+ i +"\" style=\"POSITION: ");

document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");

document.write("visible; TOP: 15px; LEFT: 15px;\"><img src=\"");

document.write(snowflake + "\" border=\"0\"></div>");

}

}

}

function snowNS() {  // Netscape main animation function

for (i = 0; i < no; ++ i) {  // iterate for every dot

yp[i] += sty[i];

if (yp[i] > doc_height-50) {

xp[i] = Math.random()*(doc_width-am[i]-30);

yp[i] = 0;

stx[i] = 0.02 + Math.random()/10;

sty[i] = 0.7 + Math.random();

doc_width = self.innerWidth;

doc_height = self.innerHeight;

}

dx[i] += stx[i];

document.layers["dot"+i].top = yp[i];

document.layers["dot"+i].left = xp[i] + am[i]*Math.sin(dx[i]);

}

setTimeout("snowNS()", speed);

}

function snowIE() {  // IE main animation function

for (i = 0; i < no; ++ i) {  // iterate for every dot

yp[i] += sty[i];

if (yp[i] > doc_height-50) {

xp[i] = Math.random()*(doc_width-am[i]-30);

yp[i] = 0;

stx[i] = 0.02 + Math.random()/10;

sty[i] = 0.7 + Math.random();

doc_width = document.body.clientWidth;

doc_height = document.body.clientHeight;

}

dx[i] += stx[i];

document.all["dot"+i].style.pixelTop = yp[i];

document.all["dot"+i].style.pixelLeft = xp[i] + am[i]*Math.sin(dx[i]);

}

setTimeout("snowIE()", speed);

}

if (ns4up) {

snowNS();

} else if (ie4up) {

snowIE();

}

</script>

 

<p align=right>

<form  >

<select size=4 name=clr onChange="document.bgColor=this.options[this.selectedIndex].value">

<option value="red">red

<option value="tan">tan

<option value="blue">blue

<option value="lime">lime

<option value="gold">gold

<option value="black" Selected>black

<option value="white">white

<option value="wheat">wheat

<option value="yellow">yellow

<option value="tomato">tomato

<option value="salmon">salmon

<option value="hotpink">hotpink

<option value="darkred">dark red

<option value="turquoise">turquoise

<option value="chocolate">chocolate

<option value="deeppink">deep pink

<option value="darkkhaki">dark khaki

<option value="cadetblue ">cadet blue

<option value="aquamarine">aquamarine

<option value="springgreen">springgreen

<option value="darkslateblue">dark slate

<option value="darksalmon">dark salmon

<option value="darkgoldenrod">dark goldenrod

</select>

</form>

</p>

</body>

</html>

 


Информация о работе Органайзер с возможностью записи заметок по дате на языке javascript