ㄧΑ
ㄧΑ琌パㄆン臱笆┪讽ウ砆秸ノ磅︽狡ㄏノ祘Α絏
ミㄧΑ
ㄧΑ
function realcool()
ㄧΑず祘Α絏
function reallycool()
{
JavaScript祘Α絏
}
ㄧΑ㏑
ㄧΑ把计
function reallycool(coolcar, coolplace)
{
JavaScript祘Α絏
}
ㄧΑ把计
function reallycool(coolcar, coolplace)
{
var mycar = coolcar;
}
function reallycool(coolcar, coolplace)
{
document.write("My car is a " + coolcar);
}
ㄏノ把计
function reallycool(coolcar, coolplace)
{
document.write("My car is a " + coolcar + " and I drive it to " + coolplace);
}
ㄧΑず return 痹瓃
function hello(name)
{
return "hello, Mr. or Ms. " + name;
}
script い㊣ㄧΑ
hello("Lee");
head 跋办㊣ㄧΑ
ミ JavaScript 癟よ遏
window.alert("This is an alert!");
<html>
<head>
<script language="JavaScript">
<!--
window.alert("This is an alert!");
//-->
</script>
</head>
<body>
html 絏
</body>
</html>
ㄧΑい㊣ JavaScript 癟よ遏
<html>
<head>
<script language="JavaScript">
<!--
function show_message()
{
window.alert("This is an alert!");
}
show_message();
//-->
</script>
</head>
<body>
html 絏
</body>
</html>
body 跋办㊣ㄧΑ
<html>
<head>
<script language="JavaScript">
<!--
function print_text()
{
document.write("I came from a function!");
}
//-->
</script>
</head>
<body>
<h4> body 跋办㊣ㄧΑ</h4>
<script language="JavaScript">
<!--
print_text();
//-->
</script>
<p>
<B>This is a bold statement!</B>
</body>
</html>
眖ㄧΑ㊣ㄧΑ
<head>
<script language="JavaScript">
<!--
function update_alert()
{
window.alert("Welcome! This site is updated daily!");
}
function call_alert()
{
update_alert();
}
call_alert();
//-->
</script>
</head>
ㄒ:
<head>
<script language="JavaScript">
<!--
function update_alert()
{
window.alert("Welcome! This site is updated daily!");
}
function section_alert()
{
window.alert("Please visit the picture section!");
}
function links_alert()
{
window.alert("Also, check out my links page!");
}
function get_message()
{
update_alert();
section_alert();
links_alert();
}
get_message();
//-->
</script>
</head>
狦
㊣Τ把计ㄧΑ
<head>
<script language="JavaScript">
<!--
function alerts( message )
{
window.alert( message );
}
function get_message()
{
alerts("Welcome! This site is updated daily!");
alerts("Please visit the picture section!");
alerts("Also, check out my links page!");
}
get_message();
//-->
</script>
</head>
ㄏノ办跑计
<script language="JavaScript">
<!--
var mycar = "honda";
var paycheck = 1200;
function new_car()
{
mycar = "Ferrari"; // 办跑计
paycheck = 3500; // 办跑计
document.write( "You need $" + paycheck + " to get a " + mycar );
}
new_car();
document.write( "You make $" + paycheck + " and have a " + mycar );
//-->
</script>
狦
ㄏノ跋办跑计
<script language="JavaScript">
<!--
var mycar = "honda";
var paycheck = 1200;
function new_car()
{
var mycar = "Ferrari"; // 跋办跑计
var paycheck = 3500; // 跋办跑计
document.write( "You need $" + paycheck + " to get a " + mycar+ "." );
}
new_car();
document.write( "You make $" + paycheck + " and have a " + mycar + ".");
//-->
</script>
狦
㊣Τ return 痹瓃ㄧΑ
<script language="JavaScript">
<!--
function get_added_text()
{
var text1 = "This is ";
var text2 = "fun!";
var added_text = text1 + text2;
return added_text;
}
var alert_text = get_added_text();
window.alert( alert_text );
//-->
</script>
狦