|
||||||||||||
|
||||||||||||
<INPUT TYPE=submit VALUE=" Метод Alert " LANGUAGE="Javascript" onclick="alert('Здесь Ваше сообщение')"> В виде ссылки : |
<INPUT TYPE=submit VALUE=" Метод Confirm " LANGUAGE="Javascript" onclick="confirm('Здесь Ваш вопрос')"> В виде ссылки : |
<INPUT TYPE=submit VALUE=" Метод Prompt " LANGUAGE="Javascript" onclick="prompt('Здесь Ваш запрос')"> В виде ссылки : |
Вот пример практического применения метода confirm. Script определяет открыл ли пользователь страницу во фрейме, если нет - выводит запрос:
<html> <head> <title>Пример практического применения метода Confirm</title> <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"> <script language="javascript"><!-- </head> <br><br><br><br> </> |
Ну и напоследок несколько слов о работе скрипта: когда вы заходите на страницу со скриптом, у вас запрашивают ваше имя, которое впоследствии записывается в файлы cookies, следовательно если скрипт запросит ваше имя на одной странице, то на всех последующих ваше имя будет индетифицировано автоматически. Это очень удобно, скажем, при on-line обучении, ну при... сами догадаетесь :)
<body onLoad="Message()">
<script language="JavaScript">
<!-- Welcome Message
/* THINGS YOU CAN ALTER */
message="текст сообщения";
colours=new Array('fff000','00ff00')//Pick your colours, any amount.
siZe=26;//Explorer only! can be outrageous size.
/* THINGS YOU SHOULDN'T ALTER */
message=message.split(' ');
timer=null;
clrPos=0;
msgPos=0;
jog=1;
currentStep=10;
step=8;
ns=(document.layers)?1:0;
viz=(document.layers)?'hide':'hidden';
if (ns)
document.write("<div id='T' style='position:absolute'></div><br>");
else{
document.write("<div style='position:absolute'>");
document.write("<div align='center' style='position:relative'>");
document.write("<div id='T' style='position:absolute;width:0;height:0;font-family:Arial;font-size:0'>kurt</div>");
document.write("</div></div><br>");
}
function Message(){
var pageHeight=(document.layers)?window.innerHeight:window.document.body.offsetHeight;
var pageWidth=(document.layers)?window.innerWidth:window.document.body.offsetWidth;
if (ns){
ypos=pageHeight/2;
var Write='<div align="center" style="width:0px;height:0px;font-family:Arial,Verdana;font-size:'+currentStep/4+'px;color:'+colours[clrPos]+'">'+message[msgPos]+'</div>';
document.T.top=ypos + -currentStep/8 +window.pageYOffset;
document.T.document.write(Write)
document.T.document.close();
}
else{
ypos=pageHeight/2;
xpos=pageWidth/2;
T.style.width=currentStep;
T.style.pixelTop=ypos+ -currentStep/16 +document.body.scrollTop;
T.style.pixelLeft=(xpos-20)+ -currentStep/2;
T.style.fontSize=currentStep/8;
T.innerHTML=message[msgPos];
T.style.color=colours[clrPos];
}
if (ns)step+=5;
else step+=15;
currentStep+=step
if (ns){
if (currentStep > pageWidth) {currentStep=10;step=8;msgPos+=jog;clrPos+=jog}
if (clrPos >= colours.length) clrPos=0;
}
else
{
if (currentStep > pageWidth*siZe) {currentStep=10;step=8;msgPos+=jog;clrPos+=jog}
if (clrPos >= colours.length) clrPos=0;
}
if (msgPos >= message.length)
{
clearTimeout(timer);
if (ns) document.T.visibility=viz;
else T.style.visibility=viz;
}
timer=setTimeout("Message()",10)
}
//-->
</script>
seo & website usability | inet | os faq | hardware faq | memory | video | cpu | hdd | mainboard faq | printer & scaner | modem | mobiles | hackzone |
po gonn © 2005 "JULI'S BEEHIVE" |
|
![]() |
|