码迷,mamicode.com
首页 > 编程语言 > 详细

JavaScript学习笔记——基本知识

时间:2015-07-24 12:32:16      阅读:141      评论:0      收藏:0      [点我收藏+]

标签:

1>JavaScript的放置和注释

  1.输出工具

    A.alert();

    B.document.write();

    C.prompt("","");

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>输出函数测试</title>
</head>

<body>
<script>
    <!-- 弹出对话框显示 -->
    alert("<h1>后盾网</h1>");

    <!-- 页面显示 -->
    document.write("<h1>后盾网视频教程</h1>");

    <!-- 弹出输入对话框,一个提示参数,一个输入参数 -->
       var value=prompt("please enter your name","")
       <!-- 显示输入的参数 -->
       alert(value);
</script>
</body>
</html>

  2.JavaScript如何在html页面当中进行放置

    A.<script></script>  放在<head></head>中间,也可以放在<body></body>中间,有两个属性,一个是type,另外一个是language

      div中加样式:写class,<div class="one"></div>,然后在<head></head>中写

<style>
   .one{
     width:100px;
     height:100px;
     background:red;
     font-size:12px;
     color:blue;
   }
</style>

 

JavaScript学习笔记——基本知识

标签:

原文地址:http://www.cnblogs.com/tonglin0325/p/4673004.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!