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

Here goes the result:



UIScriptInGeneva.jpg



Thanks,


Berny


Hi Berny,



Your script is not working in Helsinki. I want to modify Banner 'glide.product.description' banner description dynamically, basis on some condition.


Any solution?


Hi Siddharth,  




I tried the script today in an instance with Helsinki and it's working great.




What problem are you facing?  




Thanks,


Berny


Hi Berny,



Here is my script:



addLoadEvent(u_setCustomTitle);



function u_setCustomTitle(){


$j(".banner-text").innerHTML=dynamic_title;


}



I want to modify banner text dynamically. Code is running fine I can see dynamic_title in alert box but it doesn't allow me to manipulate the DOM element i.e .banner-text


Hi Siddharth, it depends on the context ("window") on which your script is running. That's why on mine i have the following:



getTopWindow().document



so that the script runs on the context where the navigation window is available.



Thanks,


Berny