hello dears friends develppers.
i have posted similar question but i didn't get solution and i tryed diferent way but nothing done and decide to comme back, anyway.
i have a div with id login-box inside i have login form.
i get a jquery tutorial and i made it popup to open the popup i have i link in page like this <a href="#login-box" class="login-window">Login / Sign In</a></p> but what i want is open it when user try to submit and he is not loginfor it i placed a javascript form validation:

function showloginbox()
{
var client=document.forms["formulaireajout"]["client"].value;
if (client==null || client=="")
  {
   window.location = "#login-box";
  return false;
  }
}
</script>

but on the search bar i get something like this www.domain.com/page.php#login-box
login-box don't apear help please.

Recommended Answers

All 4 Replies

Do not use 'window.location'. It navigates to a new page i.e. your popup window.

To show a popup, use

var strWindowFeatures = "menubar=no,location=yes,resizable=no,scrollbars=no,status=yes";
var windowObjectReference = window.open("http://popup.url/", "Popup Name", strWindowFeatures);

See for more details about window object. You may also check window.openDialog method.

HTH

i tryed window.open(#login-box) it open the current page in new tab like this url.php#login-box and popup don't apear.
and i tryed window.opedialog nothing happen.
i have created my popup in jquery i just want to open it if client field is empty onSubmit

can i have help here please????

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>button_fancybox</title>

<link rel="stylesheet" type="text/css" href="css/jquery.fancybox.css"  />
<link rel="stylesheet" type="text/css" href="css/css.css" />

<script type="text/javascript" src="js/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="js/jquery.mousewheel-3.0.6.pack.js"></script>
<script type="text/javascript" src="js/jquery.fancybox.js"></script>
<script type="text/javascript" src="js/jquery.fancybox-buttons.js"></script>
<script type="text/javascript" src="js/jquery.fancybox-thumbs.js"></script>
<script type="text/javascript" src="js/jquery.fancybox-media.js"></script>
<script type="text/javascript">
$(document).ready(function() {

    $(".fancybox").fancybox();

        $('.fancybox-buttons').fancybox({
                openEffect  : 'none',
                closeEffect : 'none',

                prevEffect : 'none',
                nextEffect : 'none',

                closeBtn  : false,

                helpers : {
                    title : {
                        type : 'inside'
                    },
                    buttons : {}
                },

                afterLoad : function() {
                    this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
                }
            });


});
</script>


</head>

<body>

<div class="wrapper">
    <div class="content">
     <h3>Button helper</h3>
    <p>
        <a class="fancybox" data-fancybox-group="button"  href="images/Lighthouse.jpg"><img src="images/1_s.jpg" alt="#" /></a>

        <a class="fancybox" data-fancybox-group="button"  href="images/Penguins.jpg"><img src="images/2_s.jpg" alt="#" /></a>

        <a class="fancybox" data-fancybox-group="button"  href="images/3_b.jpg"><img src="images/3_s.jpg" alt="#" /></a>

        <a class="fancybox" data-fancybox-group="button"  href="images/4_b.jpg"><img src="images/4_s.jpg" alt="#" /></a>
    </p>


    </div>

</div>

</body>
</html>

this is the simple code for pop up image you can get help from this...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.