2013-02-18 31 views
0

我嘗試提交表單到一個iFrame和iFrame內得到的搜索結果。無論我寫什麼文本,都可以將搜索推到只是令人耳目一新的父頁和子頁。形式提交給iframe中不工作 - 它只是刷新父和iframe

我有這樣的父頁面代碼:

<form id="SearchForm" <form action="http://itmjobs.ro/" target="my-iframe" method="post"> 
     <label><strong>What?</strong><em><input type="text" value="job title, keywords or company name" onblur="if(this.value=='') this.value='job title, keywords or company name'" onFocus="if(this.value =='job title, keywords or company name') this.value=''" /></em></label> 
     <label><strong class="color">Where?</strong><b><input type="text" value="city, state or zip code" onblur="if(this.value=='') this.value='city, state or zip code'" onFocus="if(this.value =='city, state or zip code') this.value=''" /></b></label> 
     <a href="#" class="SearchForm-link" onClick="document.getElementById('SearchForm').submit()">Search</a> 
<div class="wrapper"> 
    <td><iframe id="my-iframe" iframe name="my-iframe" iframe allowtransparency="yes" align="right" src="http://itmjobs.ro/" frameborder="0" height="1000" scrolling="no" width="1200"></iframe> 

這與iframe代碼,我必須提交的文本字段:

<div class="quickSearchInputField">Cuvinte cheie<br/> <input type="text" value="" class="searchText" name="keywords[all_words]" id="keywords" /> 
<div class="quickSearchInputName">Oras<br/><input type="text" name="City[like]" id="City" class="searchStringLike" value="" /> 
<div class="quickSearchInputName"><br/><input type="submit" id="btn-search" class="button" value="Cauta"/></div> 

回答

0

您需要return false您提交防止頁面刷新。

onClick="document.getElementById('SearchForm').submit() return false;"