小编Den*_*oys的帖子

为什么我总是从Chrome获得"Uncaught SyntaxError:Unexpected token u"?

我花了整整一天时间,谷歌搜索和寻找答案,但仍然无法弄清楚.

我的代码有点长,它在Firefox中运行良好,但从Chrome中获取"Uncaught SyntaxError:Unexpected token u".

任何人都可以指出我错在哪里吗?提前致谢!

// when the page loads, list all the current contacts
$(document).ready(function(){

    // check if localStorage database exists
    if(!localStorage.getItem("customerDatabase")){

        // define a JSON object to hold all current address
        var contacts = {
            "users":[
                {
                    "id":"1",
                    "name":"dennis",
                    "email":"dennisboys@gmail.com"
                },
                {
                    "id":"2",
                    "name":"zoe",
                    "email":"zoeisfemale@gmail.com"             
                }
            ]   
        } // end of contacts JSON object

        // stringify the object 
        var stringObject = JSON.stringify(contacts);                

        // store it into localStorage database
        var storedDatabase = localStorage.setItem("customerDatabase", stringObject);                                            

    } else {
        // …
Run Code Online (Sandbox Code Playgroud)

javascript json

15
推荐指数
1
解决办法
3万
查看次数

如何将python 3.3脚本转换为可执行文件?我找到了PyInstaller和py2exe,但两者都不支持3.3

如何将python 3.3脚本转换为可执行文件?我找到了PyInstaller和py2exe,但都不支持3.3.

http://www.pyinstaller.org/

http://sourceforge.net/projects/py2exe/files/py2exe/0.6.9/

这两个工具最多都支持2.7.但我的脚本是用3.3编写的.

我在论坛帖子中搜索了所有指向不支持3.3的旧工具.

python

11
推荐指数
2
解决办法
3万
查看次数

为什么我的雪会落后?(一个模仿下雪的程序)

下面是我的Javascript文件.这些雪在开始时看起来都很好,但是当它们中的一些触到屏幕底部时,会发生某种奇怪的行为.雪开始出现意外行为,并且不是以编程的方式反复上下移动.

通过陈述我的代码,我无法弄清楚为什么.任何人都可以指出我出错的地方吗?

提前致谢!

/*
1. mimic the snow falling
*/

$(document).ready(function(){  



// get the height and width of the browser window
var windowHeight = $(window).height();
var windowWidth = $(window).width();

// set the height and width of the #snowingScreen div equivalent to that of the window's
$('#snowingScreen').css('height', windowHeight);
$('#snowingScreen').css('width', windowWidth);  


// this function is to generate snow randomly scattered around screen
function generateSnow() {

    // generate snow using a for loop
    for(i=0; i<4; i++){

        // randomize the top position of the …
Run Code Online (Sandbox Code Playgroud)

javascript jquery

7
推荐指数
1
解决办法
239
查看次数

如何在64位win7上安装Pygame?

我搜索了论坛,发现了一些相关的问题,但似乎对我来说不容易理解.

我来到https://bitbucket.org/pygame/pygame/downloads但它只提供32位安装程序.我使用的是64位Win7,它已经安装了Python 3.3.2.在这种情况下如何安装Pygame?谢谢.

python pygame

6
推荐指数
1
解决办法
2万
查看次数

为什么不透明度为0,但我的if语句仍然执行?

我对我的代码有疑问.

$(this).css('opacity')用来检查一个元素是否透明.当元素是透明的时,它应该返回0.

但是,if( $(this).css('opacity') !== 0 )当它返回0时执行.任何想法为什么会这样?

提前致谢!

我的代码在这里:

http://jsfiddle.net/dennisboys/f3JuH/2/

javascript jquery opacity

1
推荐指数
1
解决办法
270
查看次数

为什么{} .toString可以检查数据类型?

谁能解释为什么这些代码可以检查数据类型?它们对我没有意义.我无法理解代码背后的代码.提前致谢!

var toClass = {}.toString // {} is for what? toString is a method?

alert(toClass); // alert it I get a function? = > function toString() {[native code]}

alert( toClass.call( [1,2] ) )  
alert( toClass.call( new Date ) ) 
Run Code Online (Sandbox Code Playgroud)

javascript

1
推荐指数
1
解决办法
411
查看次数

标签 统计

javascript ×4

jquery ×2

python ×2

json ×1

opacity ×1

pygame ×1