2013-03-20 34 views
0

是否有可能提交搜索表單時頁A轉發搜索表單網頁B其iframe和在IFRAME搜索結果負荷網頁B提交搜索表單到另一個頁面,它的IFRAME

其實如果我搜索上頁A它加載與結果的iframe頁面,但我需要加載網頁B在iframe中。

下面是測試頁A http://mysite.com/lidl/page1.html和網頁B http://mysite.com/lidl/page2.html

頁#1搜索形式:

<form id="SearchForm" action="http://mysite.com/search-results-jobs/" target="" method="post"> 
    <input type="hidden" name="action" value="search" /> 
    <input type="hidden" name="listing_type[equal]" value="Job" /> 
    <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=''" name="keywords [all_words]" /></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=''" name="City[all_words]" /></b> 
    </label> 
    <a href="#" class="SearchForm-link" onclick="document.getElementById('SearchForm').submit()"/>Search</a> 
</form> 

頁#2

<form id="SearchForm" action="http://mysite.com/search-results-jobs/" target="my-iframe" method="post"> 
    <input type="hidden" name="action" value="search" /> 
    <input type="hidden" name="listing_type[equal]" value="Job" /> 
    <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=''" name="keywords[all_words]" /></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=''" name="City[all_words]" /></b> 
    </label> 
    <a href="#" class="SearchForm-link" onclick="one(); two(); three(); four();">Search</a> 
    <input type="submit" id="btn-search" class="button" value="Cauta"/> 
</form> 
<iframe id="my-iframe" name="my-iframe" align="right" src="http://mysite.com" frameborder="0" height="100%" scrolling="no" width="100%"></iframe> 
+0

將表單轉發到另一個相同的表單有什麼意義?爲什麼不直接填寫表格B? – Christophe 2013-03-20 19:41:44

+0

首頁將有驚人的設計,而搜索結果頁面將是典型的。 – Blazer 2013-03-20 20:15:30

回答

0

由搜索引擎所使用的通常的技術是在url中傳遞查詢。下面是怪物的例子(搜索的JavaScript在聖迭戈,加利福尼亞州):

http://jobsearch.monster.com/search/?q=JavaScript&where=San-Diego__2C-CA 

谷歌也這樣工作,等

您可以應用這自己的網頁,輕鬆通過查詢從A到B.

另一個好處是人們可以通過電子郵件發送查詢結果。

+0

而且錘子踢在我有..好吧,我只是一個新手試圖以最簡單有效的方式解決這個問題。後面的軟件腳本是在Smarty中製作的,這就是爲什麼我把它作爲Iframe使用,因爲它很難重新設計它。如果你可以用上面的代碼來幫助我添加正確的腳本,使其能夠按需工作,我將永遠是非常棒的。 – Blazer 2013-03-20 20:43:08

+0

對不起,我無法幫到這裏。也許用這個信息更新你的帖子和標籤? – Christophe 2013-03-21 02:18:46

相關問題