English 中文(简体)
• 如何管理多种职能,然后退约
原标题:how to run multiple functions and then a callback

再次重申 在黑手脚的黑暗艺术中,我敢说,我实际上做些什么,但却没有很多东西。 我都知道,我通过规定其他法典的界限并修改法典,使守则发挥作用,经过许多曲解之后,我做了工作。

下面是我的法典的一部分,它正确地建立并展示了一个动态的选箱,其价值从我的头巾回来。 当用户从清单中选择其中一个项目时,该代码成功地运行了显示与该项目有关的地图的功能。

我还需要做的是,这部法律还显示第一期调查所交还的缺省/顶项目的地图,而新项目一旦选定,新项目就应当运行,显示新选地图。

I hope the explanation has been clear enough, but feel free to chastise me if not.

非常感谢

页: 1

 $(document).ready(function() {
$( #selecthere ).load( /temp/php_script.php?r= + random, function () 
 { //callback
$( select , this).change(function () { //catch onchange event of select
//call your function here, pass the selected value
initialize($(this).val());
});
});
});
最佳回答

(摘自以下评论)

如果我理解,<代码>初始化(val)是指与val有关的地图的功能,如果带val的页数在选箱中出现任何故障,则你要加以操作。 为做到这一点,您仅可在ready功能中添加以下功能:

$(document).ready(function(){
    var random = Math.random();
    // load contents of php script into #selecthere element
    $( #selecthere ).load( /temp/php_script.php?r= + random, function (){ 
       // the contents of the php script are now loaded
       // go ahead and call initialize() on the value that is selected by default
       initialize($( select[name=title] ).val());
       // attach a function to fire when select element is changed
       $( select[name=title] ).change(function () { 
           // here  this  refers to the select element
           // call initialize() with the value of select element
           initialize($(this).val());
       });
    });
});

我理解希望。

问题回答




相关问题
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.

热门标签