Forum Discussion
rraghvani
2 years agoChampion Level 3
This is what the script code looks like for your scenario,
function HighlightButtons()
{
// URL: https://www.w3schools.com/bootstrap/bootstrap_buttons.asp
var btn1 = 'Sys.Browser("chrome").Page("https://www.w3schools.com/bootstrap/bootstrap_buttons.asp").Panel("belowtopnav").Panel(0).Panel("main").Button(0)';
var btn2 = "Aliases.panelMain.buttonDanger";
var btn3 = "Aliases.panelMain.buttonDefault";
var btn4 = "Aliases.panelMain.buttonInfo";
var btn5 = "Aliases.panelMain.buttonLink";
Sys.HighlightObject(btn1); // Error: Type mismatch.
Sys.HighlightObject(eval(btn1));
Sys.HighlightObject(eval(btn5));
}
Whether using the full name (btn1) or the alias name (btn5), using eval function evaluates JavaScript code represented as a string and returns its completion value. The source is parsed as a script.
Notice that the first Sys.HighlightObject throws an error.
Related Content
- 2 years ago
- 4 years ago
Recent Discussions
- 3 days ago
- 3 days ago
- 6 days ago