按钮的Chrome浏览器问题

时间:2012-10-31 13:01:36

标签: javascript rally

我遇到了Button的问题。它出现在IE和Firefox中,但没有出现在Chrome中。

该按钮的代码使用的是Rally API,它是在加载页面时生成的。

我试过谷歌搜索答案,但我找不到任何东西。

继承我的代码:

function onClick(b, args) {
    if(OneButtonClickFlag == true) {
        OneButtonClickFlag = false;
        var buttonValue = args.value;
        var userName = "__USER_NAME__";
        TimeSheetReport(); // calling the “timesheet report “

    }
}

function onLoad() {
    var config = {
        text: "Generate",
        value: "myValue"
    };

    var button = new rally.sdk.ui.basic.Button(config);
    button.display("buttonDiv", onClick); // call the “onclick” function 
}

rally.addOnLoad(onLoad);

1 个答案:

答案 0 :(得分:0)

下面的这个应用似乎与你的代码一起使用,直到它遇到你的OneButtonClick标志。我在Chrome中测试了它。这对你有用吗?

<head>
    <title>Button Example</title>
    <meta name="Name" content="Component Example: Button"
    />
    <meta name="Version" content="2010.4" />
    <meta name="Vendor" content="Rally Software" />
    <script type="text/javascript" src="https://rally1.rallydev.com/apps/1.26/sdk.js"></script>
    <script type="text/javascript">
        function onClick(b, args) {
            console.log("works until this undefined variable");
            if (OneButtonClickFlag == true) {
                OneButtonClickFlag = false;
                var buttonValue = args.value;
                var userName = "__USER_NAME__";
                TimeSheetReport(); // calling the “timesheet report “

            }
        }

        function onLoad() {
            var config = {
                text: "Generate",
                value: "myValue"
            };

            var button = new rally.sdk.ui.basic.Button(config);
            button.display("buttonDiv", onClick); // call the “onclick” function 
        }

        rally.addOnLoad(onLoad);
    </script>
</head>

<body>
    <div id="buttonDiv"></div>
</body>