<!-- TODO FIXME: WEBMASTER to fix: Once one javascript drag and drop is fixed, search for "isDone()" to fix those as well. -->
<!-- /TODO FIXME: drag event --> #bgmap {LEFT: 0px; POSITION: absolute; TOP: 0px; WIDTH: 10px} #11map {LEFT: 440px; POSITION: absolute; TOP: 45px; WIDTH: 1px} #12map {LEFT: 440px; POSITION: absolute; TOP: 60px; WIDTH: 1px} #13map {LEFT: 440px; POSITION: absolute; TOP: 75px; WIDTH: 1px} #14map {LEFT: 440px; POSITION: absolute; TOP: 90px; WIDTH: 1px} #15map {LEFT: 440px; POSITION: absolute; TOP: 105px; WIDTH: 1px} #16map {LEFT: 440px; POSITION: absolute; TOP: 120px; WIDTH: 1px} #17map {LEFT: 440px; POSITION: absolute; TOP: 135px; WIDTH: 1px} #18map {LEFT: 440px; POSITION: absolute; TOP: 150px; WIDTH: 1px} #19map {LEFT: 440px; POSITION: absolute; TOP: 165px; WIDTH: 1px} #1Amap {LEFT: 440px; POSITION: absolute; TOP: 180px; WIDTH: 1px} #1Bmap {LEFT: 440px; POSITION: absolute; TOP: 195px; WIDTH: 1px} #1Cmap {LEFT: 440px; POSITION: absolute; TOP: 210px; WIDTH: 1px} #1Dmap {LEFT: 440px; POSITION: absolute; TOP: 225px; WIDTH: 1px} #1Emap {LEFT: 440px; POSITION: absolute; TOP: 240px; WIDTH: 1px} #congrats {LEFT: 90px; POSITION: absolute; TOP: 328px; VISIBILITY: hidden; WIDTH: 1px} //var engaged = false var offsetX = 0 var offsetY = 0 var selectedObj var selectedState = "" var selectedSateIndex function state(abbrev, fullName, x, y) { this.abbrev = abbrev this.fullName = fullName this.x = x this.y = y this.done = false } <!-- finishing position--> var states = new Array() states\[0\] = new state("11", "GOTO Main2", 50, 221) states\[1\] = new state("12", "MOVLW 01", 50, 137) states\[2\] = new state("13", "BCF 03,5", 50, 165) states\[3\] = new state("14", "GOTO Main", 50, 249) states\[4\] = new state("15", "END", 50, 305) states\[5\] = new state("16", "BTFSS 06,0", 50, 207) states\[6\] = new state("17", "BSF 06,0", 50, 235) states\[7\] = new state("18", "GOTO Main", 50, 278) states\[8\] = new state("19", "ORG 0", 50, 95) states\[9\] = new state("1A", "CLRF 06", 50, 179) states\[10\] = new state("1B", "BSF 03,5", 50, 109) states\[11\] = new state("1C", "MOVWF 05", 50, 151) states\[12\] = new state("1D", "BCF 06,0", 50, 263) states\[13\] = new state("1E", "CLRF 06", 50, 123) function showProps(obj, objName) { var result = "" count = 0 for (var i in obj) { result += objName + "." + i + "=" + obj\[i\] + "\\n" count++ if (count == 25) { alert(result) result = "" count = 0 } } alert(result) } function getSelectedMap() { selectedObj = (window.event.srcElement).parentElement if (selectedObj) { var stateName = selectedObj.id.substring(0,2) selectedObj = selectedObj.style for (var i = 0; i < states.length; i++) { if (states\[i\].abbrev == stateName ) { selectedStateLabel = document.all(stateName + "label") selectedStateIndex = i selectedObj.zIndex = 100 return } } selectedObj = null selectedStateLabel = null selectedStateIndex = null } return } function dragIt() { if (selectedObj) { selectedObj.pixelLeft = (window.event.clientX - offsetX) selectedObj.pixelTop = (window.event.clientY - offsetY) } } function toggleEngage() { if (selectedObj) { release() } else { engage() } } function engage() { getSelectedMap() if (selectedObj) { offsetX = window.event.offsetX - document.body.scrollLeft offsetY = window.event.offsetY - document.body.scrollTop } } function release() { if (selectedObj) { if (onTarget()) { states\[selectedStateIndex\].done = true if (isDone()) { document.all.congrats.style.visibility = "visible" } } else { states\[selectedStateIndex\].done = false document.all.congrats.style.visibility = "hidden" } selectedObj.zIndex = 0 selectedObj = null selectedState = "" } } function onTarget() { var x = states\[selectedStateIndex\].x var y = states\[selectedStateIndex\].y var objX = selectedObj.pixelLeft var objY = selectedObj.pixelTop if ((objX >= x-30 && objX <= x+30) && (objY >= y-30 && objY <= y+30)) { selectedObj.pixelLeft = x selectedObj.pixelTop = y return true } return false } function isDone() { for (var i = 0; i < states.length; i++) { if (!states\[i\].done) { return false } } return true } ![](images/Expt1.gif)
Correct. Click on the instructions, pull everything apart, and try again.
Quick Links
Legal Stuff
Social Media