`
morgan-java
  • 浏览: 57145 次
  • 性别: Icon_minigender_1
  • 来自: 上海
文章分类
社区版块
存档分类
最新评论

Javascript Tutorial

阅读更多
Please check this website: http://www.w3schools.com/JS.

1. How to Handle Simple Browsers
Browsers that do not support JavaScript, will display JavaScript as page content.
To prevent them from doing this, and as a part of the JavaScript standard, the HTML comment tag should be used to "hide" the JavaScript.
Just add an HTML comment tag <!-- before the first JavaScript statement, and a --> (end of comment) after the last JavaScript statement, like this:
<html>
<body>
<script type="text/javascript">
<!--
document.write("Hello World!");
//-->
</script>
</body>
</html>

2. Where to Put the JavaScript
JavaScripts in the body section will be executed WHILE the page loads.
JavaScripts in the head section will be executed when CALLED.

3. JavaScript Popup Boxes
Alert Box: alert("sometext");
Confirm Box: confirm("sometext");
Prompt Box: prompt("sometext","defaultvalue");
<html>
<head>
<script type="text/javascript">
function show_prompt()
{
var name=prompt("Please enter your name","Harry Potter");
if (name!=null && name!="")
  {
  document.write("Hello " + name + "! How are you today?");
  }
}
</script>
</head>
<body>
<input type="button" onclick="show_prompt()" value="Show prompt box" />
</body>
</html>

4. JavaScript For...In Statement
The for...in statement loops through the elements of an array or through the properties of an object.
for (variable in object)
  {
  code to be executed
  }

5. JavaScript Events
Events are actions that can be detected by JavaScript.
(1) onLoad and onUnload

To be continued.

分享到:
评论

相关推荐

    javascript Tutorial

    JavaScript教程 JavaScript是一种广泛应用于网页和网络应用的脚本语言,尤其在前端开发中占据了核心地位。它由网景公司的Brendan Eich在1995年发明,最初是为了解决网页上的交互问题,使得用户界面更加动态和响应式...

    JavaScript - JavaScript Tutorial

    ### JavaScript - JavaScript Tutorial #### JS基础 - **JS Home**:这部分主要介绍JavaScript的基本概念,包括语言的历史、特点以及在Web开发中的应用。 - **JS Introduction**:介绍JavaScript的入门知识,适合...

    Javascript tutorial

    在"javascript tutorial in html"这个描述中,我们可以理解为这是一系列关于如何在HTML文档中使用JavaScript的教程。JavaScript通常通过内联方式(在HTML标签中使用`&lt;script&gt;`标签)、外部文件引用(创建.js文件然后...

    javascript tutorial 3

    本教程“JavaScript Tutorial 3”似乎聚焦于深入理解和实践JavaScript的核心概念,以及如何在HTML环境中应用它们。 首先,我们看到文件列表中有“JSTnavigate.htm”,这可能是一个关于JavaScript导航的章节,讲解...

    javascript - javascript tutorial

    ### JavaScript教程概览 #### 关于本教程 JavaScript是一种轻量级、解释型的编程语言,主要用于创建网络中心的应用程序。它与Java互补并可集成使用。由于JavaScript能够与HTML集成,因此非常易于实现。此外,...

    JavaScript Tutorial.docx

    JavaScript是Web开发中不可或缺的一部分,它是一种轻量级的编程语言,主要用于增加网页的交互性。这个教程将引导初学者逐步了解JavaScript的基础知识。 1. 变量(Variables) 变量是存储数据的容器。在JavaScript...

    Creating a Simple Star Rating using JavaScript Tutorial.zip

    在本教程中,我们将探讨如何使用JavaScript创建一个简单的星评系统。这个星评系统是许多网站上常见的功能,用于让用户对产品、服务或内容进行评级。JavaScript作为一种客户端脚本语言,能够实现动态交互,使我们的星...

    JavaScript Bible 6th Edition

    This is a detailed reference and tutorial guide to the JavaScript language. It is divided into six parts and the following chapters: Part 1 - Getting Started With JavaScript: JavaScript's Role In The...

    es6tutorial基础入门

    ES6不会破坏你已经写好的JS代码。目前看来,成千上万的Web网站依赖for-in循环,其中一些网站甚至将其用于数组遍历。如果想通过修正for-in循环增加数组遍历支持会让这一切变得更加混乱,因此,标准委员会在ES6中增加...

    Object.Oriented.JavaScript

    This book explores JavaScript for what it is: a highly expressive and lexible prototype-based object-oriented programming language. Once dismissed as a toy for designers to make things such as ...

    JavaScript 圣经第5版-Javascript编程宝典--黄金版 .rar

    Part II: JavaScript Tutorial - Summary. Chapter 4: Browser and Document Objects. Chapter 5: Scripts and HTML Documents. Chapter 6: Programming Fundamentals, Part I. Chapter 7: Programming ...

    Web 开发 二、系统管理 三、编程语言 四、数据库

    The Modern JavaScript Tutorial(中文,英文) 你不知道的 JS Speaking JavaScript 急性子程序员的 JavaScript 教程 JavaScript 语言教程(中文) 理解 ES6 探索 ES6 探索 ES2016 和 ES2017 探索 ES2018 和 ES2019 ...

    js4py:JavaScript tutorial for Python programmers,Python程序员JavaScript教程

    From Python to JavaScript介绍本文假设你已经对Python有一定的了解。首先,我们会从一个简单JavaScript程序开始,这会让我们对这门语言有一个初步的印象。然后,我们会研究大多数编程语言都具有的主要结构:数据...

    liaoxuefeng_javascript_tutorial

    JavaScript的核心语法相对稳定,尽管如此,随着JavaScript在服务器端的崛起,例如通过Node.js的应用,JavaScript已然演变成了一个全能型的编程语言。对于初学者来说,JavaScript的上手相对容易,但精通这门语言并...

    javascript-tutorial-master该存储库

    这个"javascript-tutorial-master"存储库是专门为学习JavaScript编程语言而创建的一个资源库。它源于Webbrain Academy的Sardor mukhtorov的在线教程,旨在帮助初学者和有一定基础的开发者深入理解JavaScript的核心...

Global site tag (gtag.js) - Google Analytics