Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <script type="text/javascript" src="lib/http_code.jquery.com_jquery-1.9.1.js"></script>
- <title></title>
- </head>
- <body>
- <script type="text/javascript">
- $(document).ready(function ()
- {
- var $msgid = $("#msgid");
- $msgid.html("This is Hello World by JQuery");
- $("a").click(function ()
- {
- alert("Hello world!");
- });
- var foo = [1, 2, 3, "sdf"];
- $msgid.html(foo.length);
- // A function being attached to an object at runtime
- var myName = "the global object";
- var sayHello = function ()
- {
- var message = "Hi! My name is " + this.myName;
- console.log(message);
- };
- var myObject = {
- myName: "Rebecca"
- };
- var secondObject = {
- myName: "Colin"
- };
- myObject.sayHello = sayHello;
- secondObject.sayHello = sayHello;
- sayHello(); // "Hi! My name is the global object"
- myObject.sayHello(); // "Hi! My name is Rebecca"
- secondObject.sayHello(); // "Hi! My name is Colin"
- });
- </script>
- <div id="msgid">
- </div>
- <a href="">Link</a>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement