Jump to content

Unable create next step in HTML,Javascript, CSS


Rahmanhitech

Recommended Posts

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 by Rahmanhitech
Link to comment
Share on other sites

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

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

  • 2 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...