|
Dzieci to nie książeczki do kolorowania. Nie da się wypełnić ich naszymi ulubionymi kolorami.
|
2">
25 <!--
26
27 var curGreet = iconIdx = 0;
28 var backgroundIdx = 0;
29 var baseURL = ".";
30 var bRef = parent.Back;
31
32 function showGreeting(selIdx) {
33 if (selIdx > 0) {
34 bRef.hideSlide("greeting" + curGreet);
35 bRef.showSlide("greeting" + selIdx);
36 curGreet = selIdx;
37 }
38 }
39
40 function nextBackground() {
41 backgroundIdx = (backgroundIdx == bRef.backImgs.length - 1 ?
42 backgroundIdx = 0 : backgroundIdx + 1);
43 if(document.all) {
44 bRef.document.background.src = bRef.backImgs[backgroundIdx].src;
45 }
46 else {
47 bRef.document.layers["Back"].document.images[0].src =
48 bRef.backImgs[backgroundIdx].src;
49 }
50 }
51
52 function nextIcons() {
53 for (var i = bRef.iconNum * iconIdx; i < (bRef.iconNum * iconIdx) +
54 bRef.iconNum; i++) {
Przykład 10.3. front.html (ciąg dalszy)
55 if (i < bRef.icons.length && !onCard(i)) {
56 bRef.hideSlide(bRef.icons[i]);
57 }
58 }
59 iconIdx = (iconIdx >= (bRef.icons.length / bRef.iconNum) - 1 ? 0 :
60 iconIdx + 1);
61 for (var i = bRef.iconNum * iconIdx; i < (bRef.iconNum * iconIdx) +
62 bRef.iconNum; i++) {
63 if (i < bRef.icons.length) {
64 bRef.showSlide(bRef.icons[i]);
65 }
66 else { break; }
67 }
68 }
69
70 function resetForm() {
71 if (document.all) {
72 bRef.hideSlide("greeting" +
73 document.EntryForm.Greetings.selectedIndex);
245 Rozdział 10 - Elektroniczne życzenia: poczta elektroniczna metodą przenieś i upuść 74 document.EntryForm.reset();
75 }
76 else {
77 bRef.hideSlide("greeting" +
78 document.layers["SetupForm"].document.EntryForm.Greetings.selectedIndex);
79 document.layers["SetupForm"].document.EntryForm.reset();
80 }
81 }
82
83 function onCard(iconRef) {
84 var ref = bRef.refSlide(bRef.icons[iconRef]);
85 var ref2 = bRef.refSlide("Back");
86 if(document.all) {
87 if((parseInt(ref.left) >= parseInt(ref2.left)) &&
88 (parseInt(ref.top) >= parseInt(ref2.top)) &&
89 (parseInt(ref.left) + parseInt(ref.width) <= parseInt(ref2.left) +
90 parseInt(ref2.width)) &&
91 (parseInt(ref.top) + parseInt(ref.height) <= parseInt(ref2.top) +
92 parseInt(ref2.height))) {
93 return true;
94 }
95 }
96 else {
97 if((ref.left >= ref2.left) &&
98 (ref.top >= ref2.top) &&
99 (ref.left + ref.document.images[0].width <= ref2.left +
100 ref2.document.images[0].width) &&
101 (ref.top + ref.document.images[0].height <= ref2.top +
102 ref2.document.images[0].height)) {
103 return true;
104 }
105 }
106 ref.left = ((iconRef % bRef.iconNum) * 110) + bRef.startWdh;
107 ref.top = 15;
108 return false;
109 }
110
111 function shipGreeting(fObj) {
112 if (fObj.Recipient.value == "") {
113 alert('Musisz podać adres e-mail!');
114 return false;
115 }
116 else if (fObj.Message.value == "") {
117 alert("Musisz wpisać wiadomość.");
118 return false;
119 }
Przykład 10.3. front.html (ciąg dalszy)
120 else if (fObj.Greetings.selectedIndex == 0) {
121 alert('Musisz wybrać rodzaj życzeń.');
122 return false;
123 }
124
125 fObj.EntireMessage.value = genGreeting(fObj);
126 fObj.UniqueID.value = Math.round(Math.random() * 1000000);
127 fObj.BaseURL.value = baseURL;
128 return true;
129 }
130
131 function testGreeting(fObj) {
132 var msgStr = '<HTML><TITLE>Cyber Greeting Test Page</TITLE>' +
133 genGreeting(fObj) + '<TABLE ALIGN="CENTER"><TR><TD><FORM>' +
134 '<INPUT TYPE=BUTTON VALUE=" OK " onClick="self.close();">' +
135 '</FORM></TD></TR></TABLE></HTML>';
136 newWin = open('', '', 'width=' + (
137 bRef.backImgs[backgroundIdx].width + 50) +
138 ',height=600,scrollbars=yes');
139 with(newWin.document) {
140 open();
141 writeln(msgStr);
142 close();
143 }
144 newWin.focus();
145 }
146
147 function genGreeting(fObj) {
246
148 var greetingIdx = fObj.Greetings.selectedIndex;
149 var msg = fObj.Message.value;
150
151 msg = msg.replace(/\r+/g, "");
152 msg = msg.replace(/\n+/g, "<BR><BR>");
153
154 var msgStr = '<TABLE BORDER=0><TR><TD COLSPAN=2><FONT FACE=Arial>' +
155 '<H2>Twoje elektroniczne życzenia</H2>Do: ' + fObj.Recipient.value +
156 '<BR><BR></TD></TR>' + '<TR><TD VALIGN=TOP><IMG SRC="' +
157 baseURL + '/images/background' + backgroundIdx + '.jpg">' +
158 '<DIV STYLE="position:relative;left:40;top:-255;' +
159 'font-family:Arial;font-size:48px;font-weight:bold;">' +
160 parent.greetings[greetingIdx] + '</DIV>';
161
162 var iconStr = '';
163 for (var i = 0; i < bRef.icons.length; i++) {
164 if(onCard(i)) {
165 iconStr += '<DIV STYLE="position:absolute;left:' +
166 bRef.refSlide(bRef.icons[i]).left + ';top:' +
167 (parseInt(bRef.refSlide(bRef.icons[i]).top) -
|
|
|