Rahmanhitech Posted April 11, 2022 Share Posted April 11, 2022 (edited) Hi, this is my first post, Hope everyone are fine. I am new in HTML,JavaScript, CSS. I am trying to make a Spin the wheel for my site. so up to confirm dialog section, it's working okay but I need when the user click ok button in confirm box the user redirect to next page or another page or to an another site. I am unable to create it, plz. help. me (However in this section, if i able to display a popup type something, where a link button and some text can be appeared, it will also solve my problem) function confirmPrize(indicatedSegment) { // Do basic alert of the segment text. You would probably want to do something more interesting with this information. confirm("Hey,you won " + indicatedSegment.text + ' click on the link and read carefully'); $('a').on('click', function() { if ( this.host != window.somewhere.com ) { if ( window.confirm() ) { // They clicked Yes console.log('you chose to Bye.'); } else { // They clicked no console.log('you chose to stay here.'); return false } } }); } </script> </body> </html> Edited April 11, 2022 by Rahmanhitech Link to comment Share on other sites More sharing options...
Ingolme Posted April 17, 2022 Share Posted April 17, 2022 To redirect you just need to use the location.href property: location.href = "https://www.example.com"; Link to comment Share on other sites More sharing options...
Rahmanhitech Posted April 19, 2022 Author Share Posted April 19, 2022 On 4/17/2022 at 9:42 PM, Ingolme said: To redirect you just need to use the location.href property: location.href = "https://www.example.com"; Thanks, please tell me is it okay-- if ( this.host != window.somewhere.com ) { if ( window.confirm() ) { // They clicked Yes console.log('you chose to Bye.'); location.href='https://www.example.com } is not this ? Is it Okay Link to comment Share on other sites More sharing options...
Ingolme Posted April 19, 2022 Share Posted April 19, 2022 Test the code and see if it works. If it doesn't, try checking the browser's developer tools to see if there are any errors. In most browsers you can find the developer tools by pressing F12 on the keyboard. Link to comment Share on other sites More sharing options...
WolfLord Skywalker Posted May 3, 2022 Share Posted May 3, 2022 @Ingolme I'm tryna make a game with an HTML canvas. I know how to draw obstacles on a canvas. I also know how to draw on my own image from my laptop. My problem lies in combining both- drawing my image onto an obstacle filled canvas. Can u hwlp Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now