UI Script and DOM

Andrew Pishchul
Giga Expert

I'm trying to test a simple UI Script, but feel kind of lost - it's not working.. The idea is very simple - I want to make "Homepage" menu item under Self-Service red. I know the element id, but script is not working... I even added addLoadEvent function, no success... any ideas?

Screen Shot 2015-12-03 at 10.50.54 PM.png

1 ACCEPTED SOLUTION

bernyalvarado
Mega Sage

Hi Andrew,



The following global UI script does the trick in Geneva



try {


  getTopWindow().document.getElementById("4aeebcd20a0a0b9a00572ae3ad68b072").style.backgroundColor = 'red';


}


catch(e){


}



Thanks,


Berny


View solution in original post

23 REPLIES 23

Mujtaba Amin Bh
Mega Guru

Can you do an alert(elem) and see if it returns any object?



I think it is not getting handle of that element.


When I run the script as it shown on the screenshot I got an alert message 'null is not an object (evaluating 'elem.style')', that means there is some exception, but I have not idea what might cause that exception.. I tried gel() instead of getElementById with no success.


This means that elem is null.



Try using var elem = parent.document.getElementByID("id"); and let me know what happens.


That doesn't work