Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8973221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:23:51+00:00 2026-06-15T18:23:51+00:00

i did this code : the file index.php <html> <head> <title>Jeu de dammes</title> </head>

  • 0

i did this code :
the file index.php

<html>
<head>
<title>Jeu de dammes</title>
</head>
<style>
form { margin-left:500px;margin-top:300px;  width:300px }
  </style>
<body>
<form id="formulaire" style="margin-left:100px, padding: 15px" >
<table>
<tr><td><h4> The first player</h4></td>
    <td><input   type="text"   id="premier"></td>
</tr>
<tr><td><h4> The second player</h4></td>
    <td><input   type="text"   id="deuxieme"></td>
</tr>
<tr>
<td></td>
<td>
<button   id="action">Play</button></td>
</tr>
</table>
</form>
<script   src="jquery-1.5.1.js"></script>
<script>

    $(function () {

        $('#action').click(function () {

            var j1= $('#premier').val();
            var j2= $('#deuxieme').val();

            if( j1=="") alert('saisir le nom du premier joueur');
            if( j2=="") alert('saisir le nom du deuxieme joueur');
            if(j2!="" && j1!="") {$(location).attr('href',"http://www.google.com");}
        });

    $('body').css('background-image', 'url(flower2.jpg)').css('background-size', '100%');
    $("#formulaire").css('background-image', 'url(flower.jpg)');
    });
</script>
</body>
</html>

my problem is in the event click the redirection to “www.google.com” doesn’t work.any suggestions:

  1. what is the cause of this error?
  2. how can i correct it?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:23:52+00:00Added an answer on June 15, 2026 at 6:23 pm

    There’s no need to use jQuery to do something that vanilla JavaScript already does:

    window.location.href = "http://www.google.com/";
    

    It isn’t working probably because you are using a form and that submits before you can redirect. Catch the submit event:

    Change your code to this and it will work:

    $('#formulaire').submit(function(e) {
        var j1 = $('#premier').val();
        var j2 = $('#deuxieme').val();
    
        if (j1 == "") {
            alert('saisir le nom du premier joueur');
        }
    
        if (j2 == "") {
            alert('saisir le nom du deuxieme joueur');
        }
    
        if (j2 && j1) {
            window.location.href = "http://www.google.com";
        }
    
        e.preventDefault();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I did the Nodebox tutorial on the graph library: http://nodebox.net/code/index.php/Graph#loading_the_library I installed the library
I have this code in the login.php file : //save user data $token=$user->getId().'_'.hash('sha256',$user->getUsername().microtime()); $name='fsusr_'.$user->getUsername();
according to this code i dont understand about NSClassFromString how did i know viewControllerName
Did I not get enough sleep or what? This following code var frame=document.getElementById(viewer); frame.width=100;
This is the code i have. The NSDictionary did used to be something, but
I just recently found myself writing this line of code, which i did not
I want v0.1.27 of nodejs code base. This is what I did. git clone
This is my php code that connects me with another ftp server and shows
What I did: I created a index.html with a xss.js, which calls the jQuery.get()
I have this form for uploading images to the server using HttpPost. I did

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.