HTML,将iframe src设置为javascript变量

HTML,将iframe src设置为javascript变量,javascript,html,iframe,document.write,Javascript,Html,Iframe,Document.write,我想在我的另一个网页的网页中显示一个窗口,希望通过iframe。我需要将src设置为javascript变量,下面是代码: <html> <head><title>my webpage</title></head> <SCRIPT language=JavaScript type=text/javascript> function GoToURL(j) { var URLis = document.URLframe.Dest

我想在我的另一个网页的网页中显示一个窗口,希望通过iframe。我需要将src设置为javascript变量,下面是代码:

<html>
<head><title>my webpage</title></head>
<SCRIPT language=JavaScript type=text/javascript>
function GoToURL(j) {
var URLis = document.URLframe.Dest.value
document.write("<center><iframe src=\"http://www.example.com\"/ width=1350 height=500     seamless></center>");
    }
</SCRIPT>
<FORM name=URLframe>
<TABLE align=center border=0>

<TBODY>
<TR>
<TD vAlign=center align=middle><BR><INPUT maxLength=50 size=50 
  name=Dest></TD></TR>
<TR>
<TD align=middle>
  <P><INPUT onclick=GoToURL(this) type=button value="                       Go to..                                " name="Go to"></P></TD></TR></TBODY></TABLE></FORM>
</html>
简单地说,我需要将iframe src设置为变量URLis。我对html和javascript都是新手,所以请尽量保持简单。对于将iframe src设置为URLis变量的方法,您有什么建议或想法吗

谢谢。

试试这个:

var URLis = document.URLframe.Dest.value;
document.write('<center><iframe src="' + URLis + '" width=1350 height=500 seamless></center>');
试试这个:

var URLis = document.URLframe.Dest.value;
document.write('<center><iframe src="' + URLis + '" width=1350 height=500 seamless></center>');

为什么你不能把你的链接指向那个iframe?对不起,我不知道这是什么意思你的问题可能是指…:为什么你不能把你的链接指向那个iframe?对不起,我不知道这是什么意思你的问题可能是指…: