Mootools Essentials Apress’S Firstpress Series Is Your Source for Understanding Cutting-Edge Technology

Total Page:16

File Type:pdf, Size:1020Kb

Mootools Essentials Apress’S Firstpress Series Is Your Source for Understanding Cutting-Edge Technology BOOKS FOR PROFESSIONALS BY PROFESSIONALS® Available as a PDF Electronic Book MooTools Essentials MooTools Apress’s firstPress series is your source for understanding cutting-edge technology. Short, highly or Print On Demand focused, and written by experts, Apress’s firstPress books save you time and effort. They contain the information you could get based on intensive research yourself or if you were to attend a conference every other week—if only you had the time. They cover the concepts and techniques that will keep you ahead of the technology curve. Apress’s firstPress books are real books, in your choice of electronic or print-on-demand format, with no rough edges even when the technology itself is still rough. You can’t afford to be without them. MooTools Essentials: The Official MooTools Reference for JavaScript™ and Ajax Development MooTools Dear Reader, Whether you are visiting or building a web site these days, you can’t deny that JavaScript has become an important part of the experience. Visitors to web sites expect them to be interactive and responsive, and that means that those of us who build them must spend the time to make that experience come alive. In the past, JavaScript was often a tedious business, with browsers each offer- ing their own mercurial blend of standard and nonstandard functionality. Modern JavaScript has taken off with the advent of JavaScript frameworks: libraries that Essentials enhance the JavaScript language itself and help you avoid all the pesky browser bugs. MooTools is a JavaScript framework that enables you to write clean, concise, reus- able code to animate and dynamically change the content on your site using Ajax and The Official MooTools Reference for other technologies, taking care of all the grunt work for you. This book aims to make the process of getting started with MooTools an easy one, covering everything from ™ downloading the code and adding it to your pages to explaining what each class and JavaScript and Ajax Development method does (and, perhaps more importantly, when you’ll use each one). I’ve combined real-world examples with nuanced explanations of everything you need to know to make your site fun and engaging. You’ll be adding effects and Ajax in no time. Have fun, Aaron Newton 276 PAGES Newton Aaron Newton SOURCE CODE ONLINE www.apress.com User level: Beginner–Intermediate About firstPress Apress's firstPress series is your source for understanding cutting-edge technology. Short, highly focused, and written by experts, Apress's firstPress books save you time and effort. They contain the information you could get based on intensive research yourself or if you were to attend a conference every other week—if only you had the time. They cover the concepts and techniques that will keep you ahead of the technology curve. Apress's firstPress books are real books, in your choice of electronic or print-on-demand format, with no rough edges even when the technology itself is still rough. You can't afford to be without them. MooTools Essentials: The Official MooTools Reference for JavaScript™ and Ajax Development Dear Reader, Whether you are visiting or building a web site these days, you can’t deny that JavaScript has become an important part of the experience. Visitors to web sites expect them to be interactive and responsive, and that means that those of us who build them must spend the time to make that experience come alive. In the past, JavaScript was often a tedious business, with browsers each offering their own mercurial blend of standard and nonstandard functionality. Modern JavaScript has taken off with the advent of JavaScript frameworks: libraries that enhance the JavaScript language itself and help you avoid all the pesky browser bugs. MooTools is a JavaScript framework that enables you to write clean, concise, reusable code to animate and dynamically change the content on your site using Ajax and other technologies, taking care of all the grunt work for you. This book aims to make the process of getting started with MooTools an easy one, covering everything from downloading the code and adding it to your pages to explaining what each class and method does (and, perhaps more importantly, when you’ll use each one). I’ve combined real-world examples with nuanced explanations of everything you need to know to make your site fun and engaging. You’ll be adding effects and Ajax in no time. Have fun, Aaron Newton Contents Preface ..................................................................................... xi Acknowledgments...................................................................................xi A Note on the Code Formatting in This Book......................................xi Introduction ............................................................................ xiii JavaScript Frameworks ....................................................................... xiv Why You Should Use a JavaScript Framework ................................. xiv About MooTools.................................................................................... xv MooTools vs. Other Frameworks.........................................................xvii About the Author..................................................................................xix About This Book....................................................................................xx Who This Book Is For................................................................................ xxi What You Need to Know ..........................................................................xxii Summary..............................................................................................xxii Chapter 1: Getting Started with MooTools.....................................1 Downloading MooTools..........................................................................1 Downloading MooTools Official Plug-Ins ................................................... 2 Core Builder .................................................................................................. 4 Making Use of MooTools’ Modular Design................................................. 4 Compatibility................................................................................................. 5 Compression Options .................................................................................... 5 MooTools Essentials i Adding MooTools to Your Page(s).........................................................6 Coding for Reuse.....................................................................................6 Compression ............................................................................................7 Using the YUI Compressor ........................................................................... 7 Chapter 2: Reviewing MooTools ...................................................9 MooTools File Structure.........................................................................9 Manifest of MooTools Scripts ..............................................................10 The MooTools Core .................................................................................... 10 The MooTools Plug-Ins: “More” ................................................................ 17 Chapter 3: Shortcuts and Helpful Functions.................................23 Determining the Type of an Object: $type ...........................................23 $type :: Core/Core.js.................................................................................... 23 Checking Whether Values Are Defined: $defined, $chk, and $pick .................................................................25 $defined :: Core/Core.js............................................................................... 25 $chk :: Core/Core.js..................................................................................... 26 $pick :: Core/Core.js.................................................................................... 26 Working with Objects: $extend, $merge, and $unlink .........................................................................28 $extend :: Core/Core.js................................................................................ 29 $merge :: Core/Core.js ................................................................................ 31 $unlink :: Core/Core.js ................................................................................ 33 Iterable Helpers and Shortcuts: $arguments, $each, $splat, $A, and $H.................................................................34 $arguments :: Core/Core.js ......................................................................... 34 $each :: Core/Core.js................................................................................... 35 $splat :: Core/Core.js................................................................................... 36 ii MooTools Essentials $A :: Core/Core.js........................................................................................ 37 $H :: Core/Core.js........................................................................................ 38 Other Shortcuts: $clear, $empty, $lambda, $random, $time, $try .........................................................................39 $clear :: Core/Core.js .................................................................................. 39 $empty :: Core/Core.js................................................................................. 39 $lambda :: Core/Core.js .............................................................................
Recommended publications
  • Apple Software Design Guidelines
    Apple Software Design Guidelines May 27, 2004 Java and all Java-based trademarks are Apple Computer, Inc. trademarks or registered trademarks of Sun © 2004 Apple Computer, Inc. Microsystems, Inc. in the U.S. and other All rights reserved. countries. OpenGL is a trademark of Silicon Graphics, No part of this publication may be Inc. reproduced, stored in a retrieval system, or transmitted, in any form or by any means, PowerPC and and the PowerPC logo are mechanical, electronic, photocopying, trademarks of International Business recording, or otherwise, without prior Machines Corporation, used under license written permission of Apple Computer, Inc., therefrom. with the following exceptions: Any person Simultaneously published in the United is hereby authorized to store documentation States and Canada. on a single computer for personal use only Even though Apple has reviewed this manual, and to print copies of documentation for APPLE MAKES NO WARRANTY OR personal use provided that the REPRESENTATION, EITHER EXPRESS OR IMPLIED, WITH RESPECT TO THIS MANUAL, documentation contains Apple's copyright ITS QUALITY, ACCURACY, notice. MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. AS A RESULT, THIS The Apple logo is a trademark of Apple MANUAL IS SOLD ªAS IS,º AND YOU, THE PURCHASER, ARE ASSUMING THE ENTIRE Computer, Inc. RISK AS TO ITS QUALITY AND ACCURACY. Use of the ªkeyboardº Apple logo IN NO EVENT WILL APPLE BE LIABLE FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, (Option-Shift-K) for commercial purposes OR CONSEQUENTIAL DAMAGES without the prior written consent of Apple RESULTING FROM ANY DEFECT OR may constitute trademark infringement and INACCURACY IN THIS MANUAL, even if advised of the possibility of such damages.
    [Show full text]
  • Pragmatic Guide to Javascript
    www.allitebooks.com What Readers Are Saying About Pragmatic Guide to J a v a S c r i p t I wish I had o w n e d this book when I first started out doing JavaScript! Prag- matic Guide to J a v a S c r i p t will take you a big step ahead in programming real-world JavaScript by showing you what is going on behind the scenes in popular JavaScript libraries and giving you no-nonsense advice and back- ground information on how to do the right thing. W i t h the condensed years of e x p e r i e n c e of one of the best JavaScript developers around, it’s a must- read with great reference to e v e r y d a y JavaScript tasks. Thomas Fuchs Creator of the script.aculo.us framework An impressive collection of v e r y practical tips and tricks for getting the most out of JavaScript in today’s browsers, with topics ranging from fundamen- tals such as form v a l i d a t i o n and JSON handling to application e x a m p l e s such as mashups and geolocation. I highly recommend this book for anyone wanting to be more productive with JavaScript in their web applications. Dylan Schiemann CEO at SitePen, cofounder of the Dojo T o o l k i t There are a number of JavaScript books on the market today, b u t most of them tend to focus on the new or inexperienced JavaScript programmer.
    [Show full text]
  • THE FUTURE of SCREENS from James Stanton a Little Bit About Me
    THE FUTURE OF SCREENS From james stanton A little bit about me. Hi I am James (Mckenzie) Stanton Thinker / Designer / Engineer / Director / Executive / Artist / Human / Practitioner / Gardner / Builder / and much more... Born in Essex, United Kingdom and survived a few hair raising moments and learnt digital from the ground up. Ok enough of the pleasantries I have been working in the design field since 1999 from the Falmouth School of Art and onwards to the RCA, and many companies. Ok. less about me and more about what I have seen… Today we are going to cover - SCREENS CONCEPTS - DIGITAL TRANSFORMATION - WHY ASSETS LIBRARIES - CODE LIBRARIES - COST EFFECTIVE SOLUTION FOR IMPLEMENTATION I know, I know, I know. That's all good and well, but what does this all mean to a company like mine? We are about to see a massive change in consumer behavior so let's get ready. DIGITAL TRANSFORMATION AS A USP Getting this correct will change your company forever. DIGITAL TRANSFORMATION USP-01 Digital transformation (DT) – the use of technology to radically improve performance or reach of enterprises – is becoming a hot topic for companies across the globe. VERY DIGITAL CHANGING NOT VERY DIGITAL DIGITAL TRANSFORMATION USP-02 Companies face common pressures from customers, employees and competitors to begin or speed up their digital transformation. However they are transforming at different paces with different results. VERY DIGITAL CHANGING NOT VERY DIGITAL DIGITAL TRANSFORMATION USP-03 Successful digital transformation comes not from implementing new technologies but from transforming your organisation to take advantage of the possibilities that new technologies provide.
    [Show full text]
  • Comprehensive Support for Developing Graphical Highly
    AN ABSTRACT OF THE THESIS OF J-Iuan -Chao Keh for the degree of Doctor of Philosophy in Computer Science presented on July 29. 1991 Title:Comprehensive Support for Developing Graphical. Highly Interactive User Interface Systems A Redacted for Privacy Abstract approved: ed G. Lewis The general problem of application development of interactive GUI applications has been addressed by toolkits, libraries, user interface management systems, and more recently domain-specific application frameworks. However, the most sophisticated solution offered by frameworks still lacks a number of features which are addressed by this research: 1) limited functionality -- the framework does little to help the developer implement the application's functionality. 2) weak model of the application -- the framework does not incorporate a strong model of the overall architecture of the application program. 3) representation of control sequences is difficult to understand, edit, and reuse -- higher-level, direct-manipulation tools are needed. We address these problems with a new framework design calledOregon Speedcode Universe version 3.0 (OSU v3.0) which is shown, by demonstration,to overcome the limitations above: 1) functionality is provided by a rich set of built-in functions organizedas a class hierarchy, 2) a strong model is provided by OSU v3.0 in the form ofa modified MVC paradigm, and a Petri net based sequencing language which together form the architectural structure of all applications produced by OSU v3.0. 3) representation of control sequences is easily constructed within OSU v3.0 using a Petri net editor, and other direct manipulation tools builton top of the framework. In ddition: 1) applications developed in OSU v3.0 are partially portable because the framework can be moved to another platform, and applicationsare dependent on the class hierarchy of OSU v3.0 rather than the operating system of a particular platform, 2) the functionality of OSU v3.0 is extendable through addition of classes, subclassing, and overriding of existing methods.
    [Show full text]
  • 51. Graphical User Interface Programming
    Brad A. Myers Graphical User Interface Programming - 1 51. Graphical User Interface Programming Brad A. Myers* Human Computer Interaction Institute Carnegie Mellon University 5000 Forbes Avenue Pittsburgh, PA 15213 [email protected] http://www.cs.cmu.edu/~bam (412) 268-5150 FAX: (412) 268-1266 *This paper is revised from an earlier version that appeared as: Brad A. Myers. “User Interface Software Tools,” ACM Transactions on Computer-Human Interaction. vol. 2, no. 1, March, 1995. pp. 64-103. Draft of: January 27, 2003 To appear in: CRC HANDBOOK OF COMPUTER SCIENCE AND ENGINEERING – 2nd Edition, 2003. Allen B. Tucker, Editor-in-chief Brad A. Myers Graphical User Interface Programming - 2 51.1. Introduction Almost as long as there have been user interfaces, there have been special software systems and tools to help design and implement the user interface software. Many of these tools have demonstrated significant productivity gains for programmers, and have become important commercial products. Others have proven less successful at supporting the kinds of user interfaces people want to build. Virtually all applications today are built using some form of user interface tool [Myers 2000]. User interface (UI) software is often large, complex and difficult to implement, debug, and modify. As interfaces become easier to use, they become harder to create [Myers 1994]. Today, direct manipulation interfaces (also called “GUIs” for Graphical User Interfaces) are almost universal. These interfaces require that the programmer deal with elaborate graphics, multiple ways for giving the same command, multiple asynchronous input devices (usually a keyboard and a pointing device such as a mouse), a “mode free” interface where the user can give any command at virtually any time, and rapid “semantic feedback” where determining the appropriate response to user actions requires specialized information about the objects in the program.
    [Show full text]
  • Qooxdoo Interview Questions and Answers Guide
    Qooxdoo Interview Questions And Answers Guide. Global Guideline. https://www.globalguideline.com/ Qooxdoo Interview Questions And Answers Global Guideline . COM Qooxdoo Job Interview Preparation Guide. Question # 1 What is Qooxdoo? Answer:- qooxdoo is an open source Ajax web application framework. It is an LGPL- and/or EPL-licensed multipurpose framework that includes support for professional JavaScript development, a graphical user interface (GUI) toolkit and high-level client-server communication. Read More Answers. Question # 2 Is qooxdoo freely available? Answer:- Yes. qooxdoo is Open Source, dual-licensed under LGPL/EPL, i.e. the "GNU Lesser General Public License (LGPL)" and the "Eclipse Public License (EPL)". As a recipient of qooxdoo, you may choose which license to receive the code under. Read More Answers. Question # 3 Who developed qooxdoo? Answer:- qooxdoo was initiated and is maintained by 1&1, the world's biggest web hosting company. There is a team of full-time core developers as well as many committers and contributors. Read More Answers. Question # 4 Which browsers are supported? Answer:- A qooxdoo application runs in all major web browsers - with identical look & feel. Read More Answers. Question # 5 Does qooxdoo come with a server? Answer:- No. If you already have an existing backend that serves HTTP (or HTTPS) requests, it's probably fine to continue using it. Optionally qooxdoo offers several RPC servers for an elegant client-server communication. BTW, during development of your client application the local file system often is sufficient, without the need to use a real server. Read More Answers. Question # 6 What languages and technologies do we need to know? Answer:- Not many.
    [Show full text]
  • Comparative Studies of 10 Programming Languages Within 10 Diverse Criteria Revision 1.0
    Comparative Studies of 10 Programming Languages within 10 Diverse Criteria Revision 1.0 Rana Naim∗ Mohammad Fahim Nizam† Concordia University Montreal, Concordia University Montreal, Quebec, Canada Quebec, Canada [email protected] [email protected] Sheetal Hanamasagar‡ Jalal Noureddine§ Concordia University Montreal, Concordia University Montreal, Quebec, Canada Quebec, Canada [email protected] [email protected] Marinela Miladinova¶ Concordia University Montreal, Quebec, Canada [email protected] Abstract This is a survey on the programming languages: C++, JavaScript, AspectJ, C#, Haskell, Java, PHP, Scala, Scheme, and BPEL. Our survey work involves a comparative study of these ten programming languages with respect to the following criteria: secure programming practices, web application development, web service composition, OOP-based abstractions, reflection, aspect orientation, functional programming, declarative programming, batch scripting, and UI prototyping. We study these languages in the context of the above mentioned criteria and the level of support they provide for each one of them. Keywords: programming languages, programming paradigms, language features, language design and implementation 1 Introduction Choosing the best language that would satisfy all requirements for the given problem domain can be a difficult task. Some languages are better suited for specific applications than others. In order to select the proper one for the specific problem domain, one has to know what features it provides to support the requirements. Different languages support different paradigms, provide different abstractions, and have different levels of expressive power. Some are better suited to express algorithms and others are targeting the non-technical users. The question is then what is the best tool for a particular problem.
    [Show full text]
  • A/UX® Toolbox: Macintosh® ROM Interface
    A/UX®Toolbox: Macintosh®ROM Interface .® A/UX® Toolbox: Macintosh® ROM Interface 030-0787-A • APPLE COMPUTER, INC. © 1990, Apple Computer, Inc. POSTSCRIPT is a registered trademark, All rights reserved. and Illustrator is a trademark of Adobe No part of this publication may be Systems, Incorporated. reproduced, stored in a retrieval UNIX is a registered trademark of system, or transmitted, in any form or AT&T. by any means, mechanical, electronic, Simultaneously published in the photocopying, recording, or United States and Canada. otherwise, without prior written permission of Apple Computer, Inc. Printed in the United States of America. The Apple logo is a registered trademark of Apple Computer, Inc. Use of the "keyboard" logo (Option­ Shift-K) for commercial purposes without the prior written consent of Apple may constitute trademark infringement and unfair competition in violation of federal and state laws. Apple Computer, Inc. 20525 Mariani Ave. Cupertino, California 95014 (408) 996-1010 Apple, the Apple logo, AppleLink, AppleShare, AppleTalk, A!UX, LaserWriter, LocalTalk, Macintosh, MacTCP, MPW, MultiFinder and SANE are registered trademarks of Apple Computer, Inc. APDA, Finder, MacX, QuickDraw, ResEdit and SuperDrive are trademarks of Apple Computer, Inc. Ethernet is a registered trademark of Xerox Corporation. ITC Garamond and ITC Zapf Dingbats are registered trademarks of International Typeface Corporation. Microsoft is a registered trademark of ¥icrosoft Corporation. NuBus is a trademark of Texas Instruments. 030-0787-A LIMITED WARRAN1Y ON MEDIA Even though Apple has reviewed this AND REPLACEMENT manual, APPLE MAKES NO WARRANTY OR REPRESENTATION, If you discover physical defects in the EITHER EXPRESS OR IMPLIED, manual or in the media on which a WITH RESPECT TO THIS MANUAL, software product is distributed, Apple ITS QUALITY, ACCURACY, will replace the media or manual at MERCHANTABIllTY, OR FITNESS no charge to you provided you return FOR A PARTICULAR PURPOSE.
    [Show full text]
  • Resources for Application Developers All of the Links Below Are External
    Resources for Application Developers All of the links below are external websites. You MUST verify that each resource, code snippet, tutorial, or library is fully accessible. These resources are not endorsed as fully accessible. HTML WCAG 2.0 Web Accessibility Wizard HTML Tutorials and More From W3Schools (HTML5, CSS, JavaScript, XML, AJAX, PHP, etc.) Web Standards Group (web coding resources) Scripts & Applets Web Accessibility Practices Quick Reference from Web-AIM Yahoo Accessibility Blog The 5 Layers of Web Accessibility Accessibility myths in 2010 .NET Building ASP.NET 2.0 Web Sites Using Web Standards Accessibility in Visual Studio and ASP.NET ASP.NET Controls and Accessibility Walkthrough: Creating an Accessible Web Application Accessibility at Microsoft Accessibility Developer Center - MSDN Java Java Accessibility Utilities Java SE Desktop Accessibility Java Access Bridge Java Accessibility API JLCA 3.0 - Java Accessibility (JAAPI) Swing Chapter 24. (Special topics) Accessibility JavaScript Web Semantics: Accessible JavaScript & CSS Accessible Image and Text Slideshow using JQuery Making AJAX work with Screen Readers Accessible JQuery Tabs Examples Usable and Accessible Form Validation and Error Recovery Understanding Progressive Enhancement Support Detection – simple checks on a browser’s JavaScript object support Creating Accessible JavaScript (Including Event Handlers) iCITA: Scripting Best Practices Progressive Enhancement: What It Is, And How To Use It? Slideshow With Buttons Replacing <noscript>
    [Show full text]
  • Ext-JS Job Interview Questions and Answers
    Ext-JS Job Interview Questions And Answers Interview Questions Answers https://interviewquestionsanswers.org/ About Interview Questions Answers Interview Questions Answers . ORG is an interview preparation guide of thousands of Job Interview Questions And Answers, Job Interviews are always stressful even for job seekers who have gone on countless interviews. The best way to reduce the stress is to be prepared for your job interview. Take the time to review the standard interview questions you will most likely be asked. These interview questions and answers on Ext-JS will help you strengthen your technical skills, prepare for the interviews and quickly revise the concepts. If you find any question or answer is incorrect or incomplete then you can submit your question or answer directly with out any registration or login at our website. You just need to visit Ext-JS Interview Questions And Answers to add your answer click on the Submit Your Answer links on the website; with each question to post your answer, if you want to ask any question then you will have a link Submit Your Question; that's will add your question in Ext-JS category. To ensure quality, each submission is checked by our team, before it becomes live. This Ext-JS Interview preparation PDF was generated at Saturday 6th February, 2021 You can follow us on FaceBook for latest Jobs, Updates and other interviews material. www.facebook.com/InterviewQuestionsAnswers.Org Follow us on Twitter for latest Jobs and interview preparation guides. https://twitter.com/InterviewQA If you need any further assistance or have queries regarding this document or its material or any of other inquiry, please do not hesitate to contact us.
    [Show full text]
  • Javascript for Web 2.0 Development Introduction
    "Web Age Speaks!" Webinar Series JavaScript for Web 2.0 Development Introduction Mikhail Vladimirov Director, Curriculum Architecture [email protected] Web Age Solutions Providing a broad spectrum of regular and customized training classes in programming, system administration and architecture to our clients across the world for over ten years ©WebAgeSolutions.com 2 Overview of Talk Overview of ECMAScript 6 release Hybrid Mobile Web Development Overview of Popular JavaScript libraries: jQuery AngularJS Modernizr _Underscore.js ©WebAgeSolutions.com 3 JavaScript for Web 2.0 Development Some JavaScript Facts Who Owns JavaScript Name The "JavaScript" name is a trademark now owned by Oracle Corporation (US Patent and Trademark Office, copyright entry #75026640). ©WebAgeSolutions.com 5 ECMAScript… JavaScript is un-related to Java It was originally designed by Netscape to add scripting to their browser. It was called 'LiveScript'. Re-naming it to JavaScript was a marketing trick to get more attention to it It is more of a “Lisp in C's Clothing” with elements of functional programming (http://javascript.crockford.com/javascript.html ) Each browser’s JavaScript engine is an attempt to implement ECMAScript standard (first draft in 1997) Well-known implementations are JavaScript, JScript and ActionScript ©WebAgeSolutions.com 6 ECMAScript Release 6 (Work in Progress) Classes and modules ( import {func1} from ‘js/mylib’ ) Better variable scoping (let for the new block scope) Multiple return values (return {x, y})
    [Show full text]
  • DOM: Document Object Model
    DOM: Document Object Model • browser presents an object interface – accessible from and modifiable by Javascript • DOM entities have methods, properties, events – element properties can be accessed & changed – elements can be added or removed • document object holds page contents – elements stored in a tree: HTML tags, attributes, text, code, ... – each element is accessible through the DOM – through functions called from Javascript • page is "reflowed" (smart redraw) when anything changes • window object also has methods, properties, events – alert(msg), prompt(msg), open(url), ... – size, position, history, status bar, ... – onload, onunload, ... – window.document: the document displayed Basic events on forms <head> <script> function setfocus() { document.srch.q.focus(); } </script> </head> <body onload='setfocus();'> <H1>Basic events on forms</H1> <form name=srch action="http://www.google.com/search?q="+srch.q.value> <input type=text size=25 id=q name=q value="" onmouseover='setfocus()'> <input type=button value="Google" name=but onclick='window.location="http://www.google.com/ search?q="+srch.q.value'> <input type=button value="Wikipedia" name=but onclick='window.location="http://en.wikipedia.com/ wiki/"+srch.q.value'> <input type=reset onclick='srch.q.value=""' > </form> More examples... • in a form: <form> <input type=button value="Hit me" onClick='alert("Ouch! That hurt.")'> <P> <input type=text name=url size=40 value="http://"> <input type=button value="open" onClick='window.open(url.value)'> <P> <input type=text name=url2 size=40 value="http://"> <input type=button value="load" onClick='window.location=url2.value'> <P> <input type=button value="color it " onClick='document.bgColor=color.value'> <input type=text name=color value='type a color'> <input type=button value='make it white' onClick='document.bgColor="white"'> </form> • in a tag <body onLoad='alert("Welcome to my page")'> • on an image <img src="smiley.jpg" onMouseover='src="frowny.gif"' onMouseout='src="smiley.jpg"'> • etc.
    [Show full text]