JavaScript学习记录(二):document+hello_pro+add+string

1、document

<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=GB2312"/>
<title>use document.write</title>
<!-- script code -->
<script type="text/javascript">
document.write("hello");
document.write("<br><b>Ouput html </b>");
</script>
</head>
<body style="overflow:auto;">
<input type="buttom" value="clip me" onclick="document.write('After load page,use document.write will clear original content')"/>
</body>
</html>

2、hello_pro

<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=GB2312"/>
<title>improve hello</title>
</head>
<body style="overflow:auto;padding:0px;margin:0px;">
<div style="font-size:14px;font-weight:bold;color:white;font-family:Arial,宋体;background-color:#6090DA;padding:4px 10px">
hello
<script>
if(confirm("need time?"))
{
    dt = new Date();
    document.write(",current time is ");
    document.write(dt.toLocaleTimeString());
}
</script>
</div>
</body>
</html>

3、add

<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=GB2312"/>
<title>Input two number and calculate the add result</title>
</head>
<body style="overflow:auto;padding:0px;margin:0Px;">
<div style="font-size:14px;font-weight:bold;color:white;font-family:Arial,宋体;background-color:#6090DA;padding:4px 10px;">
<script>
intA=prompt("please input first number", "0");
intB=prompt("please input second number", "0");
document.write("first number is " + intA);
document.write("<br>second number is " + intB);
document.write("<br>sum is " + (parseInt(intA) + parseInt(intB)));
</script>
</div>
</body>
</html>

4、string

<html>
<head>
<meta http-equiv="conten-type" content="text/html;charset=GB2312"/>
<title>common use of string</title>
</head>
<body style="overflow:auto;padding:0Px;margin:0px;">
<div style="font-size:14px;font-weight:bold;color:white;font-famile:Arial,宋体;background-color:#6090DA;padding:4px 10px;">
<script>
document.write("big effect".big());
document.write("<br>bold effect".bold());
document.write("<br>fontsize=5 effect".fontsize("5"));
document.write("<br>A Unicode is " + "A".charCodeAt(0));
document.write("<br>The number which unicode value is 70 is " + String.fromCharCode(70));
document.write("<br>Test toLowerCase".toLowerCase());
document.write("<br>Test toUpperCase".toUpperCase());
</script>
</div>
</body>
</html>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值