Jump to content

Javascript Console Errors


neoaddict

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!


Link to comment
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...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.