I want to do the following:
var table = new google.visualization.XXXXX(document.getElementById(divId));
where the X's represent a variable that is set previously.
Just so you know, I'm using Google visualizations here, but I don't think that is necessarily relevant to this question.
Use square bracket notation.
var XXXXX = "someString";
var table = new google.visualization[XXXXX](document.getElementById(divId));
Pretty simple:
var table = new google.visualization[XXXXX](document.getElementById(divId));
Should do the trick.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.