Support Forums

Full Version: problem with popup login
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi guys i am new to this forum, I have tried other forums but no-one seems to reply to my post. i really need help with this, and would be very grateful who can.

When you go to my site at www.nandahosting.co.uk there is a "customer login" popup at the top right hand corner with a remember me tick box.

How can i get it so if they have logged in previously, to automatically redirect to the front-page(which is what happens when the fill out the form and click login) instead of putting there details in again.

the css for the popup is

Javascript code for the popup to popup.
Code:
function toggle(div_id) {
    var el = document.getElementById(div_id);
    if ( el.style.display == 'none' ) {    el.style.display = 'block';}
    else {el.style.display = 'none';}
}
function blanket_size(popUpDivVar) {
    if (typeof window.innerWidth != 'undefined') {
        viewportheight = window.innerHeight;
    } else {
        viewportheight = document.documentElement.clientHeight;
    }
    if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) {
        blanket_height = viewportheight;
    } else {
        if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) {
            blanket_height = document.body.parentNode.clientHeight;
        } else {
            blanket_height = document.body.parentNode.scrollHeight;
        }
    }
    var blanket = document.getElementById('blanket');
    blanket.style.height = blanket_height + 'px';
    var popUpDiv = document.getElementById(popUpDivVar);
    popUpDiv_height=blanket_height/2-150;//150 is half popup's height
    popUpDiv.style.top = popUpDiv_height + 'px';
}
function window_pos(popUpDivVar) {
    if (typeof window.innerWidth != 'undefined') {
        viewportwidth = window.innerHeight;
    } else {
        viewportwidth = document.documentElement.clientHeight;
    }
    if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) {
        window_width = viewportwidth;
    } else {
        if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) {
            window_width = document.body.parentNode.clientWidth;
        } else {
            window_width = document.body.parentNode.scrollWidth;
        }
    }
    var popUpDiv = document.getElementById(popUpDivVar);
    window_width=window_width/2-150;//150 is half popup's width
    popUpDiv.style.left = window_width + 'px';
}
function popup(windowname) {
    blanket_size(windowname);
    window_pos(windowname);
    toggle('blanket');
    toggle(windowname);        
}



this is the link at the homepage(www.nandahosting.co.uk) the "customer login" link.
Code:
                    <ul id="toplinkslilo">
                            <li>
                                <p><a class="custloginpu" href="#" onclick="popup('popUpDiv')">Customer Login</a></p>
                            </li>
                            <li>
                                <p><a href="<%= url_prefix %>blog">Blog</a></p>
                            </li>
                            <li>
                                <p><a href="<%= url_prefix %>forum">Forum</a></p>
                            </li>
                    </ul>



This is the form within the div id.

Code:
            <div id="blanket" style="display:none;"></div>
            <div id="popUpDiv" style="display:none;">
                <div id="tbright">
                    <a href="#" onclick="popup('popUpDiv')"><img src="<%= url_prefix %>./theme-images/xclose.png" alt="close" style="float: right; width: 30px; height:26px;" class="close"/></a>
                    <h4>Customer Login</h4>
                    <form action='login' method="post">
                        <div id="boxleft">
                            <p><label for="username2">Username:</label><input name='username' type='text' value='' id='username2'/></p>
                            <p><label for="password">Password:</label><input type='password' name='password' value='' id='password'/></p>
                            <p><label for="permanent">Remember me?</label><input type='checkbox' name='permanent' style="margin: 0 0 20px 10px; width: 13px; float: right; height: 13px;" value='1' id='permanent'/></p>
                        </div>
                    
                        <div id="boxright">
                            <input name="" type="submit" class="btn" value="Login" style="position: relative;"/>
                            <p class="link"><b>New Customer? - </b><a href="<%= url_prefix %>register">Create an account</a></p>
                            <p class="link"><a href="<%= url_prefix %>password-reminder">Forgotten your Password?</a></p>
                        </div>
                    
                    </form>
                </div>
            </div>




I have literally been searching on google for the past few days, trying new things and everything. i have honestly really tried my hardest but i can't get around it. would really appreciate if someone could help me.

thankyou so much

This is the Java section. Not JavaScript.
oh.. right. sorry, could moderator delete this threat, will post it over to javascript.
have you got a javascript section?
found itSmile. just posted it over there.