Created
September 6, 2011 06:55
-
-
Save yingtai/1196786 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*var element = document.getElementById('card0'); | |
if (element == null) { | |
alert('Card element is not found. Check element id.'); | |
} else { | |
var myevent = document.createEvent('MouseEvents'); | |
myevent.initEvent('click', false, true); | |
element.dispatchEvent(myevent); | |
alert('Card color is "' + element.style.backgroundColor + '".'); | |
} | |
*/ | |
var i=0; | |
var elm; | |
var colors = new Array(); | |
var f = true; | |
while(true){ | |
elm = document.getElementById('card'+i); | |
if(elm == null) break; | |
var myevent = document.createEvent('MouseEvents'); | |
myevent.initEvent('click',false,true); | |
elm.dispatchEvent(myevent); | |
colors.push(elm.style.backgroundColor); | |
i++; | |
} | |
var click = function(nums){ | |
for (i=0; i<vars.length; i++){ | |
elm=document.getElementById('card'+nums[i]) | |
elm.dispatchEvent(myevent); | |
} | |
}; | |
var alr=new Array(); | |
for(i=0;i<colors.length;i++){ | |
for(j=0;j<color.length;j++){ | |
if(i!=j){ | |
if(color[i]==color[j]){ | |
click(i,j); | |
a.concat([i,j]); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment