Team:UCLA/anuved verma ucla2014 workspace

From 2014.igem.org

(Difference between revisions)
Line 12: Line 12:
<script type="text/javascript" charset="utf-8">
<script type="text/javascript" charset="utf-8">
-
function addEvent(obj, evt, fn, capture){
+
function addEvent(obj,evt,fn,capture){
-
evt = evt.replace('on', ' ');
+
evt=evt.replace('on','');
-
if(obj.attachEvent)
+
if(obj.attachEvent){
-
obj.attachEvent('on' + evnt, fn);
+
obj.attachEvent('on'+ evt,fn);
 +
}
else{
else{
-
if(!capture) capture = false;
+
if(!capture){
-
obj.addEventListener(evt, fn, capture);
+
capture=false;
 +
obj.addEventListener(evt,fn,capture);
 +
}
 +
}
}
}
-
 
var box = document.getElementById('box');
var box = document.getElementById('box');
addEvent(box, 'click', function(){
addEvent(box, 'click', function(){
alert('clicked');
alert('clicked');
-
})
+
})
</script>
</script>
</body>
</body>
</html>
</html>

Revision as of 20:41, 11 July 2014

iGEM UCLA