Let’s see an example for the new way:
var object = element.style; object.opacity = (opacity / 100);
object.MozOpacity = (opacity / 100);
object.KhtmlOpacity = (opacity / 100);
object.filter = "alpha(opacity=" + opacity + ")";
var object = element.style;
You can simply copy the above function into your Pascal source file (browser side;-) and then you can call it passing the DOMHandle of any visual control together with an opacity value (in the range of 0-100) to set the element’s opacity, regardless of browser.
Let’s look at the syntax:
- The function declaration part can be pretty much the same as with any ordinary Morfik function (in the Pascal dialect you can use “function” instead of “procedure”, if you wish).
- Then we have the ['Obfuscate=false']; annotation that will direct the code generator to not obfuscate the function.