Martin Marinschek wrote:
Co-ol!

Martin tries to learn one thing a day, thanks Gerald for helping him
out with today. style.cssText, a-ha.

regards,

Martin

On 4/1/06, Gerald Müllan <[EMAIL PROTECTED]> wrote:
  
I believe you can also access the style attribute over:

elem.style.cssText = "...";

this should also work.

cheers,

Gerald

On 4/1/06, Laurie Harper <[EMAIL PROTECTED]> wrote:
    
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 _javascript_ 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"
>
[/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.


      
--
Gerald Müllan
Schelleingasse 2/11
1040 Vienna, Austria
0043 699 11772506
[EMAIL PROTECTED]

    


--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

  
Hi
Thank you all for helping me solve this problem.
I have 3 mistake :
1-I should declare a variable and put the Textfield into it , then i can access that object attribute
2-_javascript_ is case sensitive for this case and other case too , so i should use form1:staticText8
3-I should not use style and i should use , style.cssText

Thank you all.

Reply via email to