【问题标题】:How to access the value parameter of a new object created using JustGage?如何访问使用 JustGage 创建的新对象的值参数?
【发布时间】:2013-04-05 22:30:44
【问题描述】:

我没有去挖掘,因为我认为 JustGage 有什么方法等并不重要,但我有这个新对象 g

var g = new JustGage({
    id: "gauge", 
    value: 34, 
    min: 0,
    max: 100,
});

我的问题是如何在脚本后面检索 value 参数。

我认为var value = g.value 会起作用,但它不起作用。

这里是 justgage.js 文件的一部分:

 JustGage = function(config) {

  if (!config.id) {alert("Missing id parameter for gauge!"); return false;}
  if (!document.getElementById(config.id)) {alert("No element with id: \""+config.id+"\" found!"); return false;}

  var obj = this;

  // configurable parameters
  obj.config =
  {
    // id : string
    // this is container element id
    id : config.id,

    // title : string
    // gauge title
    title : (config.title) ? config.title : "",

    // titleFontColor : string
    // color of gauge title
    titleFontColor : (config.titleFontColor) ? config.titleFontColor : "#999999",

    // value : int
    // value gauge is showing
    value : (config.value) ? config.value : 0,

【问题讨论】:

  • JustGage 是如何定义的?
  • 初级,夏洛克!只需向我们提供JustGage 是什么:)
  • 文件很大,喜欢的可以去www.justgage.com看看。
  • 这取决于 JustGage 如何处理传递给它的对象。如果它只是将其丢弃或未将其存储在实例的可访问属性中,则您无法获取它。
  • 好了。 g.config.value.

标签: javascript graphael justgage


【解决方案1】:

尝试g.config.value - 通过查看 JustGage 源代码,我认为它会在那里。

【讨论】:

  • 我认为它也在配置中。
猜你喜欢
  • 2015-08-15
  • 1970-01-01
  • 2019-04-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-05-23
  • 2014-09-01
相关资源
最近更新 更多