Hey there! any question in your mind? Ask It Now!.

Popular Categories





onClick a button redirect to a URL in JAVASCRIPT

+5 votes
1,149 views
asked in Programming by payel (1,640 points)
Hello i want a button in which onClick a button by user redirect to a URL in JAVASCRIPT.

Thanks For answer.

2 Answers

+1 vote
answered by Kaperly (1,610 points)
selected by payel
 
Best answer

hey you can use this script 

<script>
function newUrl()
  {
  window.location.assign("http://URL_here")
  }
</script>
Html part button
 
<input type="button" value="visit url" onclick="newUrl()">
By this onClick a button by you can redirect to a URL.
+1 vote
answered by amit_pammu Expert (5,030 points)
<!DOCTYPE html>
<html>
<head>
<script>
function newDoc()
  {
  window.location.assign("http://www.google.com")//your url here
  }
</script>
</head>
<body>

<input type="button" value="Go" onclick="newDoc()">

</body>
</html>

Related Questions

+8 votes
2 answers 735 views
asked in Programming by mayank (250 points)
+2 votes
1 answer 134 views
+1 vote
1 answer 145 views
+1 vote
2 answers 156 views
0 votes
1 answer 98 views
+6 votes
1 answer 1,629 views
+3 votes
1 answer 2,178 views
+1 vote
1 answer 243 views
+1 vote
1 answer 734 views

Not a Member yet?

Ask to Folks Login

My Account
864 Folks are online
81 members and 783 guest online
Your feedback is highly appreciated