On my website, I want that when I click on a smiley, a certain code is added to a message area. Go here if you want to see what I mean. For now, it works very well. The code used is the following :
Before the image tags of the smilies, there is an a tag like this for example : <a href="javascript:setsmiley(' ( ')">
Here is the function associated :
function setsmiley(sm) {
document.sb.Message.value = document.sb.Message.value + sm;
}
It searchs in my page the form called "sb", and in the text area whose name is "Message" is adds the smiley. However, I have a little problem due to XHTML. For now, the form "sb" is set with name="sb". And the problem is that I need it to be id="sb" to be compliant. I already tried, but when I set it to id, it seems that the Javascript code isn't working anymore.
So, I tried a Javascript code by Dreamweaver MX :
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_changeProp(objName,x,theProp,theValue) { //v6.0
var obj = MM_findObj(objName);
if (obj && (theProp.indexOf("style.")==-1