简体   繁体   English

从JavaScript表单获取网址,然后在iframe中显示

[英]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. 我的网址看起来像“ www.google.com/”,我所要做的就是在网址末尾添加一个特定的单词(从javascript表单中获取的单词),然后在iframe中显示。 So if I will enter "test" into a form, an iframe will show "www.google.com/test" any ideas? 因此,如果我要在表单中输入“测试”,则iframe会向“ www.google.com/test”显示任何想法吗? 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 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) 现在将此new_url附加到您的iframe中,例如(可能是)

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

Makesure that your iframe id is like myIframe 确保您的iframe ID类似于myIframe

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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