简体   繁体   中英

get url from javascript form, then show in iframe

my URL looks like "www.google.com/" everything what I need to do is to add a specific word, what I will get from a javascript form, at the end of the url and then show in iframe. So if I will enter "test" into a form, an iframe will show "www.google.com/test" any ideas? Thank you a lot..

<form method="get" action="http://slovnik.juls.savba.sk/">
<form action="" method="get" target="_top">
 <input type="text" name="w" id="w" size="20" maxlength="40" value="" />
 <input type="submit" value="Nájdi" /> Stratégia: 
<select name="s"><option value="exact" selected="selected">Presne</option>
<option value="prefix" >Prefix</option>
<option value="substring" >Časť slova</option>
<option value="suffix" >Sufix</option>
</select>
 <input type="hidden" name="c" value="F819" />

v: KSSJ4

<span title="Pravidlá slovenského pravopisu"><input type="checkbox" name="d"  value="psp" checked="checked"/>PSP</span>
  </p>
</form>

Try like

 var url = document.URL;
 var new_url = url + '/' + new_word;

Now append this new_url to your iframe like(May be like)

document.getElementById('myIframe').src = new_url;

Makesure that your iframe id is like myIframe

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM