Jump to content

Code working in IE, but not FFOX / Safari... what's up with that?


dhcrusoe

Recommended Posts

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 += '&#160;';		
	}
	$(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);
}

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.