4.1 ให้นักเรียนเขียนโปรแกรมรับชื่อ
นามสกุล เมื่อรับชื่อและนามสกุลแล้วให้แสดงกล่องตอบโต้ ทักทายว่าสวัสดี
ตามด้วยชื่อที่รับมา
<html>
<head>
<script
language="javascript">
<!--
var n;
var s;
n=prompt("input Your Name");
s=prompt("input Your S_name");
alert("Hello "+n +s);
</script>
</head>
</html>
4.2
ให้นักเรียนเขียนโปรแกรมหาพื้นที่สี่เหลี่ยมผืนผ้า
และแสดงผลการหาค่าทางกล่องตอบโต้
<html>
<head>
<script
language="javascript">
<!--
var w;
var h;
w=prompt("please fill in the
width");
h=prompt("please fill in
the height");
alert("Area of a
rectangle = "+w*h );
</script>
</head>
</html>
ไม่มีความคิดเห็น:
แสดงความคิดเห็น