用HTML编写一个程序,设计一个页面,能根据目前的时间段分别显示早上好!下午好!晚上好

用HTML编写一个程序,设计一个页面,能根据目前的时间段分别显示早上好!下午好!晚上好,第1张

不知道你要的时间段是怎么分的,那我就根据我划分的时间段:

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<title>时间段提示</title>

<script>

var date=new Date();

var h=dategetHours();//获取当前时间

if(h>=0&& h<12){

alert('早上好!');

}else if(h>=12 && h<18){

alert('下午好!');

}else if(h>=18 && h<=24){

alert('晚上好!');

}

</script>

</head>

希望对你有用。

给你一个javascript的程序,文件名保存为1html就可以

<html>

<head>

<title>网页开屏 </title>

</head>

<script language="javascript">

var x = 10;

var dx = 5;

var y = windowscreenavailHeight;

var newWin = windowopen("", "myWin", "menubar=0,toolbar=0");

newWindocumentwrite("I      &nbsp      L           &nbspo           &nbspv           &nbspe            &nbsp Y     &nbspo     &nbspu!");

newWinresizeTo(x, y);

var time = windowsetInterval("active()", 100);

function active() {

if(newWinclosed){

clearInterval(time);

return;

}

else if(x < screenavailWidth){

x+=dx;

}

else {

clearInterval(time);

}

newWinresizeTo(x,y);

}

</script>

</html>

这个是及其简单的聊天

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title>简单聊天</title>

<style>

{

font-size:12px;

margin:0;

padding:0;

}

fieldset {

padding:10px;

margin:10px;

width:270px;

color:#333;

border:#06c dashed 1px;

}

legend {

color:#06c;

font-weight:800;

background:#fff;

text-align:center

}

ul {

list-style-type: none;

margin:8px 0 4px 0;

}

li {

margin-top:4px;

}

</style>

<script type="text/javascript">

function Trim(text)//去左右空格

{

return textreplace(/^\s+|\s+$/g,"");

}

function sendTxt()

{

if (Trim(documentgetElementById("txtSendContent")value)=="")

{

alert("输入的内容为空!");

documentgetElementById("txtSendContent")focus();

return false;

}

documentgetElementById("ulContent")innerHTML+="<font color='red'>me say</font>\r\n:<li>"+getPic(documentgetElementById("txtSendContent")value)+"</li>\r\n";

}

function getPic(text)

{

text=textreplace(/:\)/gim,"<img src='images/QQ/smilegif' border='0' width='24' height='24'>");

text=textreplace(/:\(/gim,"<img src='images/QQ/crygif' border='0' width='24' height='24'>");

text=textreplace(/:-\(/gim,"<img src='images/QQ/crygif' border='0' width='24' height='24'>");

text=textreplace(/:-\)/gim,"<img src='images/QQ/smilegif' border='0' width='24' height='24'>");

text=textreplace(/:)/gim,"<img src='images/QQ/smilegif' border='0' width='24' height='24'>");

//var pattern=new RegExp("\[img]","gim");

text=textreplace(/\[img]([^\[])([^\[])\[\/img]/gim,"<img src='images/QQ/$2' border='0' width='19' height='19'>");

text=textreplace("\r\n","<br>");

return text;

}

function choosePic()

{

var returnValue=windowshowModalDialog('emothtm',null,'dialogHeight:240px;dialogWidth:300px');

documentgetElementById("txtSendContent")value+=returnValue;

}

function test()

{

var ss = "Is is the cost of of gasoline going up up\n";

var re = /\b([a-z]+) \1\b/gim; //创建正则表达式样式

var rv = ssreplace(re,"$1"); //用一个单词替代两个单词

alert(rv);

}

</script>

</head>

<body style="text-align:center">

<fieldset style="width:326px">

<legend>消息显示区</legend>

<ul id="ulContent" style="text-align:left">

</ul>

</fieldset>

<br>

<fieldset>

<legend>消息发送区</legend>

<form name="form1" method="post" action="">

<label>

<textarea name="txtSendContent" id="txtSendContent" cols="40" rows="10"></textarea>

</label>

<label>

<input type="button" name="button" id="button" value="发送" onClick="return sendTxt();">

<input type="button" name="button" id="button" value="test" onClick="return test();">

</label>

<img src="images/QQ/smilegif" alt="选择表情符" title="选择表情符" style="cursor:hand" width="24" height="24" onClick="return choosePic();">

</form>

</fieldset>

</body>

</html>

你下载的只是网站程序的源码

要想公开投放网络

首先需要有一个自己的网址,就是注册购买域名

然后要有一个放置这个程序运行的服务器空间,购买虚拟主机

然后上传安装程序

即可访问网站了

Arrayprototyperow_averages = function () {         // 返回二维数组每行的平均值

            var result = [];

            for (var i = 0; i < thislength; i++) {

                var arr = this[i];

                var sum = 0;            // a数组总和

                for (var j = 0; j < arrlength; j++) {

                    sum += arr[j];

                }

                resultpush(sum / arrlength);

            }

            return result;      // 返回每行的平均值

        }

        $(function () {

            var arr = [[1, 2, 3, 4], [2, 3, 1, 5], [4, 5, 2, 6], [5, 6, 7, 1]];         // 定义二维数组

            var result = arrrow_averages();            // 调用

            var str = '';

            for (var i = 0; i < resultlength; i++) {

                str += ' 平均值=' + result[i] + '<br/>';

            }

            $('#div')html(str);

        })

        

        

<div id="div"></div>

欢迎分享,转载请注明来源:表白网

原文地址:https://h5.hunlipic.com/biaobai/3141957.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2024-02-08
下一篇2024-02-08

发表评论

登录后才能评论

评论列表(0条)

    保存