Advertisement
Guest User

javascript string replace

a guest
Sep 1st, 2015
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. <html>
  2. <body>
  3. <p id="home" onMouseOver="myFunction()">hello world hello delhi</p>
  4. <script>
  5. var a=document.getElementById("home").innerHTML;
  6.  
  7. function myFunction()
  8. {
  9.  
  10. var b=a.replace("world","mumbai");
  11. document.getElementById("home").innerHTML=b;
  12.  
  13. }
  14.  
  15. </script>
  16. </body>
  17. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement