Skip to content

Commit

Permalink
created a separate js file (#2)
Browse files Browse the repository at this point in the history
* created sepreate js file

* updating the javascript file

* refactoring
  • Loading branch information
faizalikhan-developer authored Aug 5, 2022
1 parent 441963b commit e0b17c0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
10 changes: 3 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,13 @@ <h2>ZEE WATCH CARTOON ONLINE</h2>
<h2>Please click here to be taken to the site!</h2>
<p>Please tap the below button to be taken to the site and watch cartoons :)</p>

<button onclick="myFunction()">Re-direct to watch cartoons</button>
<button id="redirect__btn">Re-direct to watch cartoons</button>

<h1> Starbucks Certified </h1>
<h1> Youtube Certified </h1>
<h1> Disney+/Netflix Certified </h1>

<script>
function myFunction() {
location.replace("https://youtu.be/dQw4w9WgXcQ")
}
</script>

<!-- Script -->
<script src="script.js"></script>
</body>
</html>
14 changes: 14 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"use strict";

// Element
const ReDirect_btn = document.getElementById("redirect__btn");

// http Redirect
const myFunction = function () {
location.replace("https://youtu.be/dQw4w9WgXcQ");
};

// Listen to Click Event
ReDirect_btn.addEventListener("click", () => {
myFunction();
});

0 comments on commit e0b17c0

Please sign in to comment.