helloo i have created a login/register box but javascript doesnt work. I dont see an error and it used to work but i have reinstall the local server and now any of my javascripts dont work. Any help?

<script type="text/javascript">
$(document).ready(function()
{

$(".tab").click(function()
{
var X=$(this).attr('id');

if(X=='signup')
{
$("#login").removeClass('select');
$("#signup").addClass('select');
$("#loginbox").fadeOut(300);
$("#signupbox").fadeIn(300);
}
else
{
$("#signup").removeClass('select');
$("#login").addClass('select');
$("#signupbox").fadeOut(300);
$("#loginbox").fadeIn(300);
}

});

});


</script>





<div id="container">
    <div id="tabbox">
        <a href="#" id="signup" class="tab signup"><?php echo $lang['SignUpForFree']; ?></a>
        <a href="#" id="login" class="tab select"><?php echo $lang['signin'];?></a>
    </div>
    <div id="panel"><br>
        <div id="loginbox" >
        some code here
        </div>
        <div id="signupbox">
        some code here
        </div>
    </div>
</div>

Recommended Answers

All 8 Replies

all of ur javascript didnt work or just this? have u enable javacript to run in ur browser?

Have you include the jquery library before your scriptings? View the console tab in developer tools(F12) to see if any include is having error/warnings.

All javascripts. How do i enable javascript? i am getting this on the console log

TypeError: a.browser is undefined jquery.colorbox-min.js:4:2587

The error means that the link to the jquery.colorbox-min.js is wrong. Try to have the correct relative path for it.

Its a browser thing. I run a simiral project i have and colorobox and other javascripts play. I read that it might be a jquery conflict but thats not it too.

i erased everything and just used a colorbox example

<?php include_once 'includes/db.php'; ?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset='utf-8'/>
        <title>Colorbox Examples</title>
        <style>
            body{font:12px/1.2 Verdana, sans-serif; padding:0 10px;}
            a:link, a:visited{text-decoration:none; color:#416CE5; border-bottom:1px solid #416CE5;}
            h2{font-size:13px; margin:15px 0 0 0;}
        </style>
        <link rel="stylesheet" href="<?php echo $base_url;?>css/colorbox.css" />
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
        <script src="<?php echo $base_url; ?>js/colorbox/jquery.colorbox.js"></script>
        <script>
            $(document).ready(function(){
                $(".inline").colorbox({inline:true, width:"50%"});

                //Example of preserving a JavaScript event for inline calls.
                $("#click").click(function(){ 
                    $('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
                    return false;
                });
            });
        </script>
    </head>
    <body>
    <?php echo $base_url.'js/colorbox/jquery.colorbox.js';?>
        <p><a class='inline' href="#inline_content">Inline HTML</a></p>
        <!-- This contains the hidden content for inline calls -->
        <div style='display:none'>
            <div id='inline_content' style='padding:10px; background:#fff;'>
            <p><strong>This content comes from a hidden element on this page.</strong></p>
            <p>The inline option preserves bound JavaScript events and changes, and it puts the content back where it came from when it is closed.</p>
            <p><a id="click" href="#" style='padding:5px; background:#ccc;'>Click me, it will be preserved!</a></p>

            <p><strong>If you try to open a new Colorbox while it is already open, it will update itself with the new content.</strong></p>
            <p>Updating Content Example:<br />
            <a class="ajax" href="../content/ajax.html">Click here to load new content</a></p>
            </div>
        </div>
    </body>
</html>

and getting this as error

This site makes use of a SHA-1 Certificate; it's recommended you use certificates with signature algorithms that use hash functions stronger than SHA-1.[Learn More] jquery.min.js
TypeError: $.browser is undefined jquery.colorbox.js:72:1
TypeError: $(...).colorbox is not a function login.php:16:0

paths work fine too

I dont know how but i fixed it. I used my code from previous project. If you know the answer please post it here for future reference. Thanks

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.