Legolas Woodland wrote:
Hi
thank you for reading my post.
I have this problem in my web application :
generated html which i view in my browser has this :

[code]

<span id="form1:staticText8" style="border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0); height: 15px; left: 23px; top: 392px; position: absolute; width: 145px">My test Value</span>
[/code]

In my java Script function i have:

[code]
function setNewColors(obj)
{
if(obj=='Yellow'){
document.getElementById("form1:statictext8").style =" left: 25px; top: 383px; position: absolute; width: 143px; border-width: 1px; border-style: solid; border-color:#fdffca; background-color:#fdffca; color: #000000;";
}
}
[/code]

i trigger the color change function in :
[code]
<select style="left: 264px; top: 240px; position: absolute; width: 288px" class="MnuStd" id="form1:dropDown1" name="form1:dropDown1" size="1" onchange="setNewColors(this.value);dropDown_changed('form1:dropDown1'); return false;">
[/code]

When i select yellow from the drop down box , it call color change but in javaScript console of FireFox i get an error like :

[code]
Error: document.getElementById("form1:statictext8") has no properties
Source File: http://localhost:28081/pluto/portal/Publisher/......
Line: 299
[/code]


can some one please tell me  what is my mistake ?

You can't say elem.style = "..." in Javascript. Style isn't a string-valued property, it's a 'special' accessor for an object with CSS style properties. You need something more like

    with(document.getElementById("form1:statictext8").style) {
        left = '25px';
        top = '383px';
        ...
    }


L.

Reply via email to