0

我有一个包含 URL 的输入字段。如果 onchange 事件触发,应该有一个 jquery 函数来提取一些值并将其传递给另一个函数。问题只是提取值。

这是网址

https://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=Beach&aq=&sll=37.09024,-95.712891&sspn=47.972233,107.138672&vpsrc=6&ie=UTF8&hq=Beach+Hotel,&hnear=South+Wales&t=m&fll=-28.639489,153.610239&fspn=0.026139,0.052314&st=115703629269948245352&rq=1&ev=zi&split=1&ll=-28.5725225,124.52239&spn=0.026139,0.052314&z=15&iwloc=A&cid=4038837565330903688  

我想从参数latitudelongitude中提取值,它们位于&ll=-28.5725225,124.52239.

请帮忙。

4

1 回答 1

0

No need for jQuery for this.

var loc = "https://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=Beach&aq=&sll=37.09024,-95.712891&sspn=47.972233,107.138672&vpsrc=6&ie=UTF8&hq=Beach+Hotel,&hnear=South+Wales&t=m&fll=-28.639489,153.610239&fspn=0.026139,0.052314&st=115703629269948245352&rq=1&ev=zi&split=1&ll=-28.5725225,124.52239&spn=0.026139,0.052314&z=15&iwloc=A&cid=4038837565330903688 ";

loc = loc.split("&ll=")[1];
loc = loc.split("&")[0];
console.log(loc);
于 2013-06-24T08:27:03.280 回答