Jump to content

Archived

This topic is now archived and is closed to further replies.

neoaddict

Javascript Console Errors

Recommended Posts

[code]<script type="text/javascript">
<!--
    function makeRequest(url) {
        var http_request = false;
        if (window.XMLHttpRequest) {
            http_request = new XMLHttpRequest();
        } else if (window.ActiveXObject) {
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }
        if (!http_request) {
            alert('Your browser does not support AJAX or XMLHttpRequest!');
            return false;
        }
        http_request.open('GET', url, true);
        if (url == "checkcookie.php") {
            http_request.onreadystatechange = parse;
        }
        http_request.send(null);
    }

    function parse() {
        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
                var css = http_request.responseText;
                document.getElementById("topsites").style.display = css;
            }
            else{
                alert('There was a problem with the request.');
            }
    }

    open('checkcookie.php');

    function omgmagic() {
        if(document.getElementById("topsites").style.display == 'none'){
           makeRequest('show.php');
           document.getElementById("topsites").style.display = '';
        }
        else{
           makeRequest('hide.php');
           document.getElementById("topsites").style.display = 'none';
        }
    }
//-->
</script>[/code]

Here are the errors that Firefox's Error Console keeps on giving me:

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Warning: function makeRequest does not always return a value
Source file: [a href=\"http://www.neo-addict.net/******/portal/\" target=\"_blank\"]http://www.neo-addict.net/******/portal/[/a]
Line: 202, Column: 4
Source code:
}

Error: missing } after function body
Source file: [a href=\"http://www.neo-addict.net/*******/portal/\" target=\"_blank\"]http://www.neo-addict.net/*******/portal/[/a]
Line: 228, Column: 5
Source code:
//-->

Warning: function makeRequest does not always return a value
Source file: [a href=\"http://www.neo-addict.net/********/portal/\" target=\"_blank\"]http://www.neo-addict.net/********/portal/[/a]
Line: 202, Column: 4
Source code:
} [/quote]

Thanks very much!


Share this post


Link to post
Share on other sites
[code]<script type="text/javascript">
<!--
    function makeRequest(url) {
        var http_request = false;
        if (window.XMLHttpRequest) {
            http_request = new XMLHttpRequest();
        } else if (window.ActiveXObject) {
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }
        if (!http_request) {
            alert('Your browser does not support AJAX or XMLHttpRequest!');
            return false;
        }
        http_request.open('GET', url, true);
        if (url == "checkcookie.php") {
            http_request.onreadystatechange = parse;
        }
        http_request.send(null);
    }

    function parse() {
        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
                var css = http_request.responseText;
                document.getElementById("topsites").style.display = css;
            }
            else{
                alert('There was a problem with the request.');
            }
        }
    }

    makeRequest('checkcookie.php');

    function omgmagic() {
        if(document.getElementById("topsites").style.display == 'none'){
           makeRequest('show.php');
           document.getElementById("topsites").style.display = '';
        }
        else{
           makeRequest('hide.php');
           document.getElementById("topsites").style.display = 'none';
        }
    }
//-->
</script>[/code]

Fixed the parse error now.

I don't know why it keeps on throwing up a

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Error: uncaught exception: Permission denied to call method XMLHttpRequest.open[/quote]

when the file is not off-server...

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.