SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    Non-Member
    Join Date
    May 2006
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Inline script compilation error, only in Opera

    I have setup an AJAX based area on a project I am working on that has tabs to load in data for different sections of the page. It works perfectly in Firefox, IE, and Safari. However, in Opera it fails miserably and I get the following error, and I can't seem to figure out what the problem is.

    Inline script compilation
    Syntax error while loading: line 90 of inline script at http://bcwars.com/market.php :
    Expected token: ')'
    function switch_it (goto) {
    -------------------------^


    This is referring to the following code:

    Code:
    function switch_it (goto) {
    		if (goto == "") {
    			document.title = "BC Wars - Market";
    			document.getElementById('market').style.display = "block";
    			document.getElementById('auctions').style.display = "none";
    			document.getElementById('trades').style.display = "none";
    			document.getElementById('shop').style.display = "none";
    			zeit = new Date();
    			ms = (zeit.getHours() * 24 * 60 * 1000) + (zeit.getMinutes() * 60 * 1000) + (zeit.getSeconds() * 1000) + zeit.getMilliseconds();
    			ajax_request("market.php?page=set_cookie&c=&x=" + ms);
    			
    			document.getElementById('market_search1').style.display = "block";
    			document.getElementById('market_search2').style.display = "none";
    			del_cookie('market_page2', '/', '.bcwars.com');
    		} else if (goto == "auctions") {
    			document.title = "BC Wars - Auctions";
    			document.getElementById('market').style.display = "none";
    			document.getElementById('auctions').style.display = "block";
    			document.getElementById('auction_search').style.display = "block";
    			document.getElementById('trades').style.display = "none";
    			document.getElementById('shop').style.display = "none";
    			zeit = new Date();
    			ms = (zeit.getHours() * 24 * 60 * 1000) + (zeit.getMinutes() * 60 * 1000) + (zeit.getSeconds() * 1000) + zeit.getMilliseconds();
    			ajax_request("market.php?page=set_cookie&c=auctions&x=" + ms);
    			
    			document.getElementById('auction_search1').style.display = "block";
    			document.getElementById('auction_search2').style.display = "none";
    			del_cookie('auction_page2', '/', '.bcwars.com');
    		} else if (goto == "trades") {
    			document.title = "BC Wars - Trades";
    			document.getElementById('market').style.display = "none";
    			document.getElementById('auctions').style.display = "none";
    			document.getElementById('trades').style.display = "block";
    			document.getElementById('trades_search').style.display = "block";
    			document.getElementById('shop').style.display = "none";
    			zeit = new Date();
    			ms = (zeit.getHours() * 24 * 60 * 1000) + (zeit.getMinutes() * 60 * 1000) + (zeit.getSeconds() * 1000) + zeit.getMilliseconds();
    			ajax_request("market.php?page=set_cookie&c=trades&x=" + ms);
    			
    			document.getElementById('trades_search1').style.display = "block";
    			document.getElementById('trades_search2').style.display = "none";
    			del_cookie('trades_page2', '/', '.bcwars.com');
    		} else if (goto == "shop") {
    			document.title = "BC Wars - Your Shop";
    			document.getElementById('market').style.display = "none";
    			document.getElementById('auctions').style.display = "none";
    			document.getElementById('trades').style.display = "none";
    			document.getElementById('shop').style.display = "block";
    			document.getElementById('inventory').style.display = "block";
    			zeit = new Date();
    			ms = (zeit.getHours() * 24 * 60 * 1000) + (zeit.getMinutes() * 60 * 1000) + (zeit.getSeconds() * 1000) + zeit.getMilliseconds();
    			ajax_request("market.php?page=set_cookie&c=shop&x=" + ms);
    		}
    	}

  2. #2
    Non-Member
    Join Date
    May 2006
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, as these things usually go, right after posting this, I found the solution. For reference, the problem was the 'goto' variable. I just changed this and it worked just fine. This was using Opear 9.50 Beta.

  3. #3
    SitePoint Guru whisher's Avatar
    Join Date
    May 2006
    Location
    Kakiland
    Posts
    732
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jls33fsls View Post
    Well, as these things usually go, right after posting this, I found the solution. For reference, the problem was the 'goto' variable. I just changed this and it worked just fine. This was using Opear 9.50 Beta.
    http://javascript.about.com/library/blreserved.htm

    It's a future reserved word

  4. #4
    Non-Member
    Join Date
    May 2006
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh okay, thank you for the reference

  5. #5
    SitePoint Guru
    Join Date
    Sep 2006
    Posts
    731
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by whisher View Post
    It's a future reserved word
    Let's hope it stays that way and never gets implemented.
    Tab-indentation is a crime against humanity.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •