PDA

View Full Version : Making this Cross browser ..


Mhtml
04-18-2003, 06:11 AM
ok, I use this script to insert emoticon codes into the text box on my shoutbox:
function addValue(theValue){
if(shoutForm.Mess.value == 'Message'){
shoutForm.Mess.value = theValue;
return true;
}else if(shoutForm.Mess.value == ''){
shoutForm.Mess.value = theValue;
return true;
}else{
shoutForm.Mess.value += theValue;
return true;
}
}

How can I make it work in more browsers? I've learnt that it doesn't work in Mozilla 1.3 ..

Skyzyx
04-18-2003, 06:48 AM
First of all, what is shoutForm.Mess.value? What is it in reference to?

Mhtml
04-18-2003, 07:18 AM
shoutForm is the name of the form and Mess is the message field.

Skyzyx
04-18-2003, 07:39 AM
Well, I'd try one of the following:


document.shoutForm.Mess.value;

// or

document.forms['shoutForm'].Mess.value;


... Since this is the JavaScript-correct way of doing it. It looks like you're using the IE shorthand way, which IMO is just plain no-good.