dhcrusoe Posted July 8, 2009 Share Posted July 8, 2009 Hey all, Been troubleshooting this code... it's working in IE, but not in Firefox or Safari. The functionality allows a piece to be edited (doubleclick) once it has been placed - try it on http://www.boolify.org. Any ideas? Thank you! --Dave Here's a bit of the relevant code: // ======= new event added @ Jul 7, 2009 ======= // the double click event newpiece.addEvent('dblclick', function(e) { e = new Event(e).stop(); // exception if (this.getProperty('class') != "button") return; // if the dblclick target is the operators, just return else { replace_flag = true; // prepare to replace the text, flag is true replace_id = this.getProperty('id'); // get the button id loadPopup(); // pop up the dialog for user to input return; } }); if (!$((count-1)+'')) // skip all the rest if this is the first piece { loadPopup(); return; } Here's the function: function replace_text(p_id) { var nv = $('newvalue').value; if (nv == '') return; if (nv.length > 75) { alert("You cannot enter more than 76 characters"); return; } // preserve the old text on the button var old_nv = $(p_id + '').innerHTML; if (nv.length < 4) { var spaces = (4 - nv.length); var spc = ''; for (var x = spaces+4; x > 0; x--) { spc += ' '; } $(p_id + '').innerHTML = '<span>' + nv + spc + '</span>'; } else $(p_id + '').innerHTML = '<span>' + nv + '</span>'; // search out if there're the same keywords around the board // if no, continue // if yes, omit the new input one, and restore to the former text // for (var x = count; x>0; x--) { if (x == p_id) continue; else { if ($(x + '').innerHTML == $(p_id + '').innerHTML) { alert("Same key words detected, please re-enter"); $(p_id + '').innerHTML = old_nv; break; } } } // restore flag and id to default value replace_flag = false; replace_id = 0; closeDialogue(false); } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.