44. Abertura da página e celular
Adicione o seguinte código à área <body>
<Script Language = "JavaScript"> <!- Comece para (t = 2; t> 0; t--) { para (x = 20; x> 0; x--) { para (y = 10; y> 0; y--) { parent.moveby (0, -x); } } para (x = 20; x> 0; x--) { para (y = 10; y> 0; y--) { parent.moveby (0, x); } } para (x = 20; x> 0; x--) { para (y = 10; y> 0; y--) { parent.moveby (x, 0); } } para (x = 20; x> 0; x--) { para (y = 10; y> 0; y--) { parent.moveby (-x, 0); } } } //-> // final -> </script> |
45. Exiba a data e a hora da máquina cliente pessoal
<Script Language = "LiveScript"> <!- escondendo hoje = nova data () *** ("O tempo presente é:", Today.gethours (), ":", Today.getminutes ()) *** ("<br> A data de hoje é:", Today.getMonth ()+1, "/", Today.getDate (), "/", Today.getyear ()); // End Hiding Contents -> </script> |
46. Gere automaticamente a última data modificada para você cada vez:
<html> <Body> Esta é uma página simples html. <br> Últimas mudanças: <Script Language = "LiveScript"> <!- ocultar o script de navegadores antigos *** (document.lastmodified) // End Hiding Contents -> </script> </body> </html> |
47. Restrições que não podem estar vazias e endereços de e -mail:
<html> <head> <Script Language = "JavaScript"> <!- Esconda função test1 (form) { if (form.text1.value == "") Alert ("Você não escreveu nada, digite novamente!") outro { alerta ("oi"+form.text1.value+"! Você inseriu completo!"); } } função test2 (form) { if (form.Text2.Value == "" || form.Text2.Value.Indexof ('@', 0) == -1) Alert ("Este não é o endereço de e-mail correto! Por favor, digite novamente!"); caso contrário, alerta ("você entrou com completo!"); } // -> </script> </head> <Body> <nome name = "primeiro"> Digite seu nome: <br> <input type = "text" name = "text1"> <input type = "button" name = "button1" value = "teste de entrada" onclick = "test1 (this.form)"> <p> Digite seu endereço de e-mail: <br> <input type = "text" name = "text2"> <input type = "button" name = "button2" value = "teste de entrada" onclick = "test2 (this.form)"> </body> |
48. Luz de corrida de cavalos
<html> <head> <Script Language = "JavaScript"> <!- Esconda var scrtxt = "Como é! Page irá "+" procurar horas em puro fascínio ... "; var lentxt = scrtxt.length; var largura = 100; var pos = 1 larga; função scroll () { POS ++; var scroller = ""; if (pos == lentxt) { pos = 1 larga; } if (pos <0) { for (var i = 1; i <= math.abs (pos); i ++) { Scroller = Scroller+"";} Scroller = roller+scrtxt.substring (0, largura-i+1); } outro { scroller = roller+scrtxt.substring (pos, largura+pos); } window.status = roller; setTimeout ("scroll ()", 150); } //-> </script> </head> <corpo onload = "scroll (); retorna true;"> Sua página da web pode ser exibida aqui! </body> </html> |
49. Use botões na página da web para controlar a exibição da página anterior, a próxima página e a página inicial.
<html> <Body> <Name de forma = "ButtonBar"> <Input type = "button" value = "back" onclick = "history.back ()"> <Input type = "button" value = "js- home" onclick = "location = 'script.html'"> <Input type = "button" value = "next" onclick = "history.forward ()"> </morm> </body> </html> |
50. Verifique o código -fonte de um determinado URL
Adicione o seguinte código à área <body>
<Cript> função add () { var ress = document.forms [0] .luxiaoqing.value window.Location = "View-Source:"+Ress; } </Script> Digite o endereço da URL para visualizar o código -fonte: <form> <input type = "text" name = "luxiaoqing" size = 40 value = "http: //"> </morm> <morm> <br> <Input type = "button" value = "Exibir código -fonte" onclick = add ()> </morm> |
51. Título exibe data
Adicione o seguinte código à área <body>:
<Script Language = "JavaScript1.2"> <!-Esconda var isnMonth = novo Array ("Janeiro", "fevereiro", "março", "abril", "maio", "junho", "julho", "agosto", "setembro", "outubro", "novembro", "dezembro") ; var isNday = novo Array ("Domingo", "Segunda -feira", "Terça -feira", "Quarta -feira", "Quinta -feira", "Friday", "Saturday", "Sunday"); hoje = new Date (); Ano = Today.getYear (); Data = Today.getDate (); if (document.all) document.title = "Hoje é:"+ano+"ano"+isnmonth [Today.getMonth ()]+data+"dia"+isNday [Today.Getday ()] //-ocultar-> </script> |