Nếu bạn sử dụng Google để tìm kiếm
nâng cao một thông tin có dạng sau:
"Ngôn ngữ/Phần mềm" "lập
trình viên" "cần tuyển"
OR "tuyển dụng"
Nhiệt độ: | |
( Nguồn: SJC Hà Nội ) |
<html>
<body>
<script type="text/javascript">
document.write("<h1>Hello World!</h1>");
</script>
</body>
</html>
<html>
<body>
<script type="text/javascript">
<!--
document.write("Hello World!");
//-->
</script>
</body>
</html>
<html>
<head>
<script type="text/javascript">
function message()
{
alert("This alert box was called with the onload event");
}
</script>
</head>
<body onload="message()">
</body>
</html>
<html>
<head>
</head>
<body>
<script type="text/javascript">
document.write("This message is written by JavaScript");
</script>
</body>
</html>
<html>
<head>
<script type="text/javascript">
function message()
{
alert("This alert box was called with the onload event");
}
</script>
</head>
<body >
<a href="#" onclick="message()">Click Here</a>
</body>
</html>
<html>
<head>
<script type="text/javascript">
function message()
{
alert("This alert box was called with the onload event");
}
</script>
</head>
<body onload="message()">
</body>
</html>
<html>
<head>
</head>
<body>
<script type="text/javascript">
document.write("This message is written by JavaScript");
</script>
</body>
</html>
// JavaScript Document
function message()
{
alert("This alert box was called with the onload event");
}
<html>
<head>
<script type="text/javascript" src="alert.js"></script>
</head>
<body >
<a href="#" onClick="message()">Click Here</a>
</body>
</html>
<script type="text/javascript">
document.write("<h1>This is a heading</h1>");
document.write("<p>This is a paragraph.</p>");
document.write("<p>This is another paragraph.</p>");
</script>
<script type="text/javascript">
// Write a heading
document.write("<h1>This is a heading</h1>");
// Write two paragraphs:
document.write("<p>This is a paragraph.</p>");
document.write("<p>This is another paragraph.</p>");
</script>
<script type="text/javascript">
/*
The code below will write
one heading and two paragraphs
*/
document.write("<h1>This is a heading</h1>");
document.write("<p>This is a paragraph.</p>");
document.write("<p>This is another paragraph.</p>");
</script>
<script type="text/javascript">
var x;
var carname;
</script
<script type="text/javascript">
var x=5;
var carname="Volvo";
</script>
<script type="text/javascript">
var x=5;
y=x-5;
z=y+5;
</script
<script type="text/javascript">
var xToaDo =5;
var _toaDo = 10;
</script>
<script type="text/javascript">
var xToaDo = 5;
var XToaDo = 10;
</script>
<script type="text/javascript">
var tongGiaTri;
var toaDoX;
var toaDoY;
</script>
Toán tử
|
Mô tả
|
Ví dụ
|
==
|
So sánh bằng
|
x==8 is false
|
===
|
So sánh tuyệt đối
|
x==="5" is false
x===5 is true
|
!=
|
Không bằng
|
x!=8 is true
|
>
|
Lớn hơn
|
x>8 is false
|
<
|
Nhỏ hơn
|
x<8 is true
|
>=
|
Lớn hơn hoặc bằng
|
x>=8 is false
|
<=
|
Nhỏ hơn hoặc bằng
|
x<=8 is true
|
Toán tử
|
Mô tả
|
Ví dụ
|
&&
|
and
|
(x < 10 && y > 1) is true
|
||
|
or
|
(x==5 || y==5) is false
|
!
|
not
|
!(x==y) is true
|
Toán tử
|
Miêu tả
|
Ví dụ
|
Kết quả
|
+
|
Cộng
|
x=y+2
|
x=7
|
-
|
Trừ
|
x=y-2
|
x=3
|
*
|
Nhân
|
x=y*2
|
x=10
|
/
|
Chia
|
x=y/2
|
x=2.5
|
%
|
Lấy giá trị số dư
|
x=y%2
|
x=1
|
++
|
Tăng
|
x=++y
|
x=6
|
--
|
Giảm
|
x=--y
|
x=4
|
Operator
|
Example
|
Same As
|
Result
|
=
|
x=y
|
x=5
| |
+=
|
x+=y
|
x=x+y
|
x=15
|
-=
|
x-=y
|
x=x-y
|
x=5
|
*=
|
x*=y
|
x=x*y
|
x=50
|
/=
|
x/=y
|
x=x/y
|
x=2
|
%=
|
x%=y
|
x=x%y
|
x=0
|