2012-07-09 36 views

回答

1

你有選擇阻斷,而不是包括它試試這個

$('#form1').find('select,input[type="text"]').not('#url').change(function(){ 
    var val = ""; 
    var url = '/static/url/to/file.php?'; 
    $('form select,input[type="text"]:not("input#url")').each(function(){ 
     if ($.trim(this.value).length > 0) { 
      val += ($(this).attr('name') + "" + this.value + "&"); 
     } 
    }) 
    $('#url').val(url+val); 
}); 

$('#button').click(function(){ 
    window.location= $('#url').val(); 
}); 

WORKING DEMO

+0

嗨mcgrailm ...工作演示似乎沒有在IE(瀏覽器工作)中工作...它在Firefox中工作嗎? – Tatters 2012-07-09 13:36:13

+0

是的,這就是我測試它...奇怪,它不起作用,即在 – mcgrailm 2012-07-09 13:43:38

+0

不錯的一個......當我失業時,我會給它一個旋風。 – Tatters 2012-07-09 13:49:25

0

您可以嘗試$( '#Form1的')。序列化(),並把現場url out of the form