From: "I am on the top of the world! Borlange University" on 19 Jan 2010 23:36 hello, i can obnot retrieve a select ject from div innerHTML. what i want to do is that when a page is loaded, first selector,say #1, would be shown in the first div by sending a request.then i choose one option from #1, fire change event of #1, the second selector #2 will be shown in div two, then choose option from #2 .............blabla.. but the problem is when selector #1 was loaded, the object #1 could not be obtained. codes: window.addEvent('domready', function() { var option=1; var result = new Request({ url:'getInfo_gx.php'<https://mail.google.com/mail/html/compose/static_files/'getInfo_gx.php'> , method:'get', onSuccess:function(response) { if(option==1) $('list_sch').innerHTML = response; //response = "<select id='sch_list><.......'"; else if(option==2) $('list_gg').innerHTML = response; else $('list_gx').innerHTML = response; } }); result.send('type=1'); // page loaded,sending a request. $('list_sch').innerHTML = "<select id='sch_list'><option value='123'>123312</option></select>"; if($('sch_list')) // heres the problem... object can not be obtained. { $('sch_list').addEvent('change',function(){ // events can not be fired option=2; result.send('type=2'+'&sch='+$('sch_list').value.replace('+','%2B')); }); } });
From: Pete Ford on 20 Jan 2010 04:23 I am on the top of the world! Borlange University wrote: > hello, i can obnot retrieve a select ject from div innerHTML. > what i want to do is that when a page is loaded, first selector,say #1, > would be shown in the first div by sending a request.then i choose one > option from #1, fire change event of #1, the second selector #2 will be > shown in div two, then choose option from #2 .............blabla.. > > but the problem is when selector #1 was loaded, the object #1 could not be > obtained. > codes: > > window.addEvent('domready', function() { > > var option=1; > > var result = new Request({ > url:'getInfo_gx.php'<https://mail.google.com/mail/html/compose/static_files/'getInfo_gx.php'> > , > method:'get', > onSuccess:function(response) > { > if(option==1) $('list_sch').innerHTML = response; //response = > "<select id='sch_list><.......'"; > else if(option==2) $('list_gg').innerHTML = response; > else $('list_gx').innerHTML = response; > > } > }); > > > result.send('type=1'); // page loaded,sending a request. > > > $('list_sch').innerHTML = "<select id='sch_list'><option > value='123'>123312</option></select>"; > > > if($('sch_list')) // heres the problem... object can not > be obtained. > { > $('sch_list').addEvent('change',function(){ // events > can not be fired > option=2; > result.send('type=2'+'&sch='+$('sch_list').value.replace('+','%2B')); > }); > } > > }); > You probably ought to ask a Javascript forum about javascript problems...
|
Pages: 1 Prev: Iterating ASTs with SPL in PHP-5.3.1 Next: How do I remove unused GET parameters from the URL? |