English 中文(简体)
我如何能动态地改变客户提出的一份联合材料?
原标题:How can I dynamically change a JS called from a client?

我有一页,上面有2个县,每10个小页都有一个大刀片。 每一次点击每个县都履行 j印功能,改变大 j功能所使用的一些变量,改变其行为。 当时,该守则非常复杂,耗费时间,我想把变数的整个计算推向服务器。 或者,我更愿意在服务器上产生全部功能。

当2个县中任何一个州受到压力时,我怎么能动地改变大片的束缚功能?

最佳回答

you子一经敦促你向服务器方面提出Ajax要求,你可以做些什么。 在那里,你根据纽瓦特的报警编制《 j法》,并寄回。 之后,你可以兑现反应,履行适当的职能。

问题回答

逐步取消大片文字,每10个ms子执行,势必会很缓慢。

改写一根大字塔是坏的,然后,你只关心文字的执行计划。 (如果你每10个ms子再寄回,使服务器过于复杂,那么服务器的快速程度如何能产生客户将执行的文字。) 客户执行将造成客户在不适当的情况下陷入困境。

然而,你认为你的文字是“固定的”,这样就更加分散。 当然,整个职能不会改变每10个方面? (在您的网站上,它从Pong的游戏转变为每10个ms形天气雷达?)

分类法(使用jquery): 假设有两端,一是 but子,一是 but子。 浮油 but子或 but子B改变内部价值,然后执行文字。

var complicatedFunction = function(){
    //private variables and methods
    var a = 2, b = 3;

    //public variables and methods
    return {
        exec: function(el){
           //which button was pushed?
           if($(el).is( .buttonA )){
               a = 4;
               b = 8;
           } else {
               a = 10;
               b = 2;
           }
           alert( The result of a*b is   +(a*b));
        }
    }
}();
$( .buttonA, .buttonB ).click(function(){complicatedFunction.exec(this)});

如果你举出一个法典的例子,也许我们可以!





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签