Article View: cn.bbs.comp.lang.java
Article #24312JAVA SCRIPT ���Բ�����
From: tangreng
Date: Sat, 04 Apr 1998 00:00
Date: Sat, 04 Apr 1998 00:00
273 lines
10571 bytes
10571 bytes
��λ��Ϻ, ���ٵ���һ����, �����ϴ��������ҳ�����ط�������,
Ϊʲôֻ��TXT �������ݶ���ʾ�?����? ���λ����С����,лл.
__________________________________________________________________
---- Ҳ �� �� �� һ �� �� �� �� �� ҳ�� �� ϣ �� �� �� �� �? ͬ ʱ�� �� ϣ
�� �� �� �� �� ҳ �� �� �� �� �� �� �� ҳ �� �� һ Щ �� �� �� �� �飬 �� ��
�� �� ij �� �� �� �� �� Ȥ�� �� ϣ �� �� �� Ҳ �� �� �� �� һ �� �� �� ��
Ҫ �� �� �� �� ���� �� �� �� ʹ �� �� �� �� ÿ һ �� �� �� �� �� ҳ �� �� ��
�� �� Ϣ�� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �ѣ� �� ��
�� ѡ �� �� �� ʵ �֣� ��CGI �� �� �� �ȡ� �� �� �� �� �� �� ��JavaScript ��
�� �� �� �� �� �� �� �� �� һ �� �� �� �� �� �ӡ�
---- �� �� �� �� �� һ �� �� ���� �� �� �� �� �� �� �� �� �� �� �� �� ��
�� ַ�� ʹ �� �� � �� �� �� ���� �� �� �� �� �� �� �� �� �� �� ϲ �� ��
վ �� �� ��?�� �� �� д �� �� Щ �� �� �� ��Submit �� ť�� �� Ϣ �� �� ͨ
�� �� �� �� �� �� �� ʽ �� �� �㡣 �� �� �� �� �� �� �� �� �� �� �� �� ��
�� �� �� �� �� �� �� �� �� �� �� �� �� �ġ� �� �� �� �� �� �� �� �� һ �� ��
�� �� ˵ ����
---- �� �� Reset() ��Reset �� ť �� �� �� �� �� �� �� �� �� λ��
---- �� �� submitForms() ��submit �� ť �� �� �� �� �� �� �� �� �� �� �� ��
�� �� �� ����
---- �� �� isName() �� �� �� �� �� �� �� �� �� �� �� �顣
---- �� �� isEmail() �� �� �� �� �� �� ַ �� �� �� �� �� �� �� �� �顣
---- �� �� isBrowser() �� � �� �� �� �� �� �� �� �� �� �� � �� �� �� �� ��
�� �� �ϡ�
---- �� �� isCountry() �� �� �� �� �� �� �� �� �� �� �� �顣
---- �� �� isComment() �� �� �� �� �� �� �� �� �� �� �� �飬 �� �� �� Ϊ ��
ֵ��
---- �� �� isFavorite() �� ϲ �� �� վ �� �� �� �� �� �� �� �� �� �飬 �� ��
�� Ϊ �� ֵ��
---- �� �� �� �� �� �� �� һ Щ �� �ɣ� �� �磬 �� �� �� �� � �� �� �� ��
���� �� �� �� �� �� �� �� �ȡ�
---- �� �� �� �� �� �� �� �� �� �� ʽ �� �� �� �� �ģ� �� �� �� �� �� �� ��
�� �� �� �� �Ρ� �� �� �� �� ���� �� �� �� �� ���� �� �� �� Դ �� �룺
< HTML >
< HEAD >
< TITLE > ��JavaScript �� �� �� �� �� �� ��< /TITLE >
< SCRIPT LANGUAGE="JavaScript" >
< !-- Begin
//Someone@abc.com �� �� �� �� �� �� �� �� �� �� ַ
var emailAddress="Someone@abc.com";
function toName()
{
var toNameval=document.forms[0].elements[1].value;
toNameval = "mailto:Someone@abc.com?subject=Guest Book example";
this.document.mail.action = toNameval;
}
function Reset() {
document.forms[0].elements[0].value = "";
document.forms[0].elements[1].value = "";
document.forms[0].elements[2].value =
navigator.appName + " " + navigator.appVersion;
document.forms[0].elements[3].value = "";
document.forms[0].elements[4].value = "";
document.forms[0].elements[5].value = "";
document.forms[0].elements[0].focus();
}
function submitForms() {
if ( (isName() ) && (isEmail()) && (isBrowser())
&& (isCountry()) && (isComment()) && (isFavorite()) )
if (confirm("\nYou're about to e-mail the form.\n\nClick
on YES to submit.\n\nClick on NO to abort."))
{
alert("\nYour submission will now be made to :
\n\n"+emailAddress+"\n\n\nThank you!");
return true;
}
else
{
alert("\nYou have chosen to abort the submission.");
return false;
}
else
return false;
}
function isName() {
var str = document.forms[0].elements[0].value;
if (str == "") {
alert("\nThe NAME field is blank.\n\nPlease enter your name.")
document.forms[0].elements[0].focus();
return false;
}
for (var i = 0; i < str.length; i++)
{
var ch = str.substring(i, i + 1);
if (((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) && ch != ' ')
{
alert("\nThe NAME field only accepts letters
& spaces.\n\nPlease re-enter your name.");
document.forms[0].elements[0].select();
document.forms[0].elements[0].focus();
return false;
}
}
return true;
}
function isEmail()
{
emailAddress=document.forms[0].elements[1].value;
if (document.forms[0].elements[1].value == "") {
alert("\nThe E-MAIL field is blank.
\n\nPlease enter your e-mail address.")
document.forms[0].elements[1].focus();
return false;
}
if (document.forms[0].elements[1].value.indexOf ('@',0) == -1 ||
document.forms[0].elements[1].value.indexOf ('.',0) == -1)
{
alert("\nThe E-MAIL field requires a \"@\"
and a \".\"be used.\n\nPlease re-enter your e-mail address.")
document.forms[0].elements[1].select();
document.forms[0].elements[1].focus();
return false;
}
else
{
toName();
return true;
}
}
function isBrowser()
{
if (document.forms[0].elements[2].value !
= navigator.appName + " " + navigator.appVersion)
{
if (confirm("\nYou've changed your browser
type.\n\nClick on OK to keep changes.\
n\nClick on Cancel to restore detected browser."))
return
true
else
{
document.forms[0].elements[2].value =
navigator.appName + " " + navigator.appVersion;
return true;
}
}
else
return true;
}
function isCountry() {
var str = document.forms[0].elements[3].value;
if (str == "") {
alert("\nThe COUNTRY field is
blank.\n\nPlease enter your country.")
document.forms[0].elements[3].focus();
return false;
}
for (var i = 0; i < str.length; i++) {
var ch = str.substring(i, i + 1);
if (((ch < "a" || "z" < ch) &&
(ch < "A" || "Z" < ch)) && ch != ' ')
{
alert("\nThe COUNTRY field only accepts
letters & spaces.\n\nPlease re-enter your country.");
document.forms[0].elements[3].select();
document.forms[0].elements[3].focus();
return false;
}
}
return true;
}
function isComment() {
if (document.forms[0].elements[4].value == "") {
if (confirm("\nYou're about to submit
without leaving a comment.\n\nClick
on CANCEL to include a comment.\n\nClick
on OK to continue without a comment."))
return true
else
{
document.forms[0].elements[4].focus();
return false;
}
}
else
return true
}
function isFavorite() {
if (document.forms[0].elements[5].value == "") {
if (confirm("\nYou're about to submit without
listing your favorite sites.\n\nClick on CANCEL
to include favorites.\n\nClick on OK to continue
without listing favorites."))
return true
else
{
document.forms[0].elements[5].focus();
return false;
}
}
else
return true
}
// End -- >
< /SCRIPT >
< /HEAD >
< BODY >
< CENTER >
< FORM ENCTYPE="text/plain"
NAME="mail" METHOD='GET'
ACTION='mailto:Someone@abc.com'
onSubmit="return submitForms()">
< TABLE BORDER=0 WIDTH=400 >
< TR >
< TD align="center" > < FONT COLOR=800000 >
< STRONG >Enter your name:< /STRONG >< /FONT >< /TD >
< TD align="center" > < FONT COLOR=800000 >
< STRONG >Enter your e-mail address:< /STRONG >
< /FONT >< /TD >
< /TR >
< TR >
< TD align="center"> < INPUT TYPE="text"
NAME="name" SIZE=30 MAXLENGTH=40 >< /TD >
< /TD >
< TD align="center" > < INPUT TYPE="text"
NAME="email" SIZE=30 MAXLENGTH=40 >< /TD >
< /TR >
< TR >
< TD align="center" > < FONT COLOR=800000 >
< STRONG >Your browser < /STRONG >< /FONT >< /TD >
< TD align="center"> < FONT COLOR=800000 >
< STRONG >Enter your country:< /STRONG >< /FONT >< /TD >
< /TR >
< TR >
< TD align="center" > < INPUT TYPE="text"
NAME="browser" SIZE=30 MAXLENGTH=60 >< /TD >
< TD align="center" > < INPUT TYPE="text"
NAME="country" SIZE=30 MAXLENGTH=60 >
< /TD >
< /TR >
< /TABLE >
< CENTER >
< FONT COLOR=800000 >< STRONG >
Leave a comment or suggestion:< /strong > < /font >< BR >
< TEXTAREA NAME="comments"
ROWS=5 COLS=50 wrap=yes >Comments?
Suggestions?< /TEXTAREA >< P >< P >
< FONT COLOR=800000 >< STRONG >
List your favorite sites:< /STRONG >< /FONT >< BR >
< TD align="center" >< TEXTAREA NAME="favorites"
ROWS=5 COLS=50 wrap=yes >
Any sites I should take a look at?< /TEXTAREA >
< P >< P >
< INPUT TYPE="submit" VALUE="Submit" >
< center >< INPUT TYPE="reset" VALUE="Reset"
onClick="Reset()" >
< /FORM >
< /CENTER >
< /BODY >
��JavaScript �� �� �� �� �� �� ��
ԭ����: �� �� ��
�� �� �� ��211 �� ��45 �� �� �� ��, 621000
lyc326@my-public.sc.cninfo.net
�����: Tangreng
e-mail: tangreng@nease.net
URL: http://tangreng.yeah.net
It is Java Paradise, it is magic world...
Technical Details
Message-ID:
<6g3ufu$gp2$1@bbs.nease.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: Chinese,GB X-Google-Thread: f6cb0,83130f8229f1715f,start X-Google-Attributes: gidf6cb0,public From: "tangreng" <tangreng@nease.net> Subject: JAVA SCRIPT ���Բ����� Date: 1998/04/04 Message-ID: <6g3ufu$gp2$1@bbs.nease.net> X-Deja-AN: 340677797 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Organization: Net Ease Newsgroups: cn.bbs.comp.lang.java