`
jarod2008
  • 浏览: 81878 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

javascript Functions

阅读更多

函数function可以被认为是Object的子类,也就是一个function对象可以拥有自己的变量和其它function对象当属性。

 

<html>

<body>

 

<input type='button' id='btn1' value='按钮1'/>

<input type='button' id='btn2' value='按钮2'/>

<script type='text/javascript'>

function doClick(str){

    if(str!=undefined)

       alert(str);

    else

       alert('varible undefined');

 

}

document.getElementById('btn1').onclick=doClick;

document.getElementById('btn2').onclick=function(){

    doClick('按钮2');

}

</script>

</body>

</html>

以上这段代码可以用来展示带参数的 函数的调用情况,不过在firefox下,点击btn1,alert的是“object MouseEvent",而在ie下点击btn1,alert的是"varible undefined"。

似乎在firefox下面,如果调用的时候没有指定参数,那么就把鼠标事件当参数传递给函数。

分享到:
评论

相关推荐

    The Principles of Object-Oriented JavaScript 1st Edition

    –What makes JavaScript functions so unique –The various ways to create objects –How to define your own constructors –How to work with and understand prototypes –Inheritance patterns for types and...

    [JavaScript][PDF][英文版]Oh My JS

    13. Control the Complexity of Your JavaScript Functions with JSHint(用JSHint控制JavaScript函数的复杂性):JSHint是一个JavaScript代码质量工具,可以检测代码中的语法错误和潜在问题,有助于保持代码质量。...

    javascript公式编辑器

    This file contains JavaScript functions to convert ASCII math notation and LaTeX to Presentation MathML. Simple graphics commands are also translated to SVG images. The conversion is done while the (X...

    Learning JavaScript(O'Reilly,3ed,2016)

    Understand the basic usage and mechanics of JavaScript functions Explore objects and object-oriented programming Tackle new concepts such as iterators, generators, and proxies Grasp the complexities ...

    Programming.the.BeagleBone.Black.epub

    Use JavaScript functions and timers Perform analog and digital I/O Work with expansion capes and modules Design Web interfaces that control electronics Assemble and program a robot and an e-mail ...

    WebGL编程指南源码.zip

    This book covers the WebGL 1.0 API along with all related JavaScript functions. You will learn how HTML, JavaScript, and WebGL are related, how to set up and run WebGL applications, and how to ...

    Getting started with WebAssembly & Emscripten-March 5, 2019.zip-共3分卷

    12 Exporting C functions to JavaScript 13 Calling JavaScript functions from C 14 Preamble Conversion Functions 15 Emscripten Module & Memory Buffer 16 Debugging 17 Runtime Initialisation 18 Emrun ...

    Getting started with WebAssembly & Emscripten-March 5, 2019.z01

    12 Exporting C functions to JavaScript 13 Calling JavaScript functions from C 14 Preamble Conversion Functions 15 Emscripten Module & Memory Buffer 16 Debugging 17 Runtime Initialisation 18 Emrun ...

    Getting started with WebAssembly & Emscripten-March 5, 2019.z02

    12 Exporting C functions to JavaScript 13 Calling JavaScript functions from C 14 Preamble Conversion Functions 15 Emscripten Module & Memory Buffer 16 Debugging 17 Runtime Initialisation 18 Emrun ...

    JS Function 名称排序

    在JavaScript中,函数是第一类对象,这意味着它们可以被赋值给变量、作为参数传递给其他函数,甚至可以作为其他函数的返回值。在这种上下文中,"JS Function 名称排序"指的是按照函数名称对这些可操作的对象进行排序...

    SCODevelopersDocumentation

    5. JavaScript函数(Toolkit JavaScript Functions):文档详述了一系列JavaScript函数,这些函数按照不同的功能进行了分类,例如: - 会话函数(Session Functions):包括初始化会话、终止会话以及设置学习者将在...

    javascript asp教程第十三课--include文件

    Experienced JavaScript programmers also know that JavaScript functions are data types. So, we should be able to store a JavaScript function inside a Session Variable or an Application Variable, ...

    JavaScript Objects Functions and Arrays Explained

    ### JavaScript Objects, Functions, and Arrays 解析 #### 引言 本书旨在为初学者和有经验的开发者提供一个深入理解JavaScript中的对象、函数与数组的机会。作者Tony de Araujo是一位技术作家兼讲师,他通过丰富...

    SignalR Programming in Microsoft ASP.NET

    Use the simple ASP.NET API in SignalR for creating server-to-client remote procedure calls (RPC) that call JavaScript functions in client browsers from server-side .NET code. Exploit the API for ...

    WhatIsJavaScriptFunctions.pdf 英文原版

    What Is JavaScript Functions

    Mathematical Functions in Javascript.zip

    本压缩包“Mathematical Functions in Javascript.zip”很可能包含一个名为“Calculator”的示例或工具,用于演示如何在JavaScript中实现数学运算。虽然没有具体的标签来进一步指导讨论方向,但我们可以深入探讨...

    带有 helperscripts 文件夹的freetextbox 控件

    3. **Custom JavaScript Functions**: 自定义的JavaScript函数,这些函数负责与FREETEXTBOX控件进行交互,比如初始化控件、添加自定义功能等。 4. **CSS Stylesheets**: 控件的样式表文件,用于定义FREETEXTBOX的...

    Effective JavaScript: 68 Specific Ways to Harness the Power of JavaScript[EPUB版]

    Precise and practical explanations of JavaScript’s functions and variable scoping semantics Useful JavaScript programming patterns and idioms, such as options objects and method chaining In-depth ...

Global site tag (gtag.js) - Google Analytics