Mukezh

Session Intro to Javascript

Apr 2nd, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1.  
  2. Introduction to Javascript
  3. =========------=============
  4. JavaScript is a widely used web-based programming language that powers the dynamic behavior on most websites, like suppose if you visit gmail you will notice only the mailbox part refreshes and the other part remains as it is that means only some part of the website is interactive.Similar case is with websites like Facebook just place the cursor in a hyperlink you will see an information this is all because of javascript. This programmming language was created by Netscape.
  5.  
  6.  
  7. Difference between JAVA and JAVASCRIPT :
  8.  
  9. Java is a software programming language. But, Javascript is meant for development of Web Applications which is generally used in front end developing.
  10.  
  11.  
  12. -----------------------X-X-X-X-X-X-X-X-X-X-X-X-X-X------------------
  13.  
  14. Several functions are used in javascript to ease the work like:
  15.  
  16. alert()
  17. prompt()
  18. document.write
  19. document.cookie
  20. getElementById
  21.  
  22. These functions are termed to be the payloads which if run in any website will give us some juicy information.
  23.  
  24. Syntax Of Javascripts
  25. ======================
  26.  
  27. <script> = Starting Tag
  28.  
  29. </script> = Ending Tag
  30.  
  31. <script>
  32. .
  33. .
  34. </script>
  35.  
  36.  
  37. A Javascript based program:
  38. =============================
  39.  
  40.  
  41.  
  42. <html>
  43. <head>
  44. <title>Java Script</title>
  45. </head>
  46. <body>
  47. <script>
  48. alert("Hacked");
  49. </script>
  50. </body>
  51. </html>
  52.  
  53. 2 Number Addition
  54. =================
  55. <html>
  56. <head>
  57. <title>Java Script</title>
  58. </head>
  59. <body>
  60. <h1>Calculator</h1>
  61. <form>
  62. First Number :<input type="text" id="one"><br>
  63. Second Number:<input type="text" id="two"><br>
  64. <button onclick="addition()">Add</button>
  65. </form>
  66. </body>
  67.  
  68. <script>
  69. function addition()
  70. {
  71. var onee = document.getElementById("one").value;
  72. var twoo = document.getElementById("two").value;
  73. var sum= +onee + +twoo;
  74. alert(sum);
  75. document.write(sum);
  76. }
  77. </script>
  78.  
  79. </html>
  80.  
  81.  
  82.  
  83. XSS (Cross Site Scripting)
  84. ===========================
  85.  
  86.  
  87. In which the web application or the web site executes the html tags as the normal input and displays the data as that using htmls tags.
  88.  
  89. In this type of attack attacker can make the target to do what ever he wants to do. An attacker can craft a link and send it to the target, when the target will open the crafter link, then the malicious work of the attacker is carried out.
  90.  
  91. There are three types of XSS
  92. ----------------------------
  93. 1. Reflected XSS
  94. 2. Stored XSS
  95. 3. DOM Based XSS
Add Comment
Please, Sign In to add comment