2011年11月26日 星期六

jQuery 改變iframe的src

做這個卡了一早上

myiframe 是iframe的id
function search(word){
$('#myiframe').attr('src', 'ProductsS.aspx?q=' + word + '');
}

<input id="abcd" maxlength="20" name="" size="20" type="text" value="" />
<input onclick="search(getElementById('abcd').value)" type="button" value="查詢" />