admin管理员组文章数量:1432613
I would like to display a window in my webpage of another webpage, hopefully via iframe. I need to set the src as a javascript variable, here is the code:
<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=\"\"/ 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>
I need to set the iframe src to the variable URLis, simply put. I am somewhat of a newb in both html and javascript, so please keep as simple as possible. Do you have any suggestions or ideas for a way to set the iframe src as URLis variable?
Thank you.
I would like to display a window in my webpage of another webpage, hopefully via iframe. I need to set the src as a javascript variable, here is the code:
<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.\"/ 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>
I need to set the iframe src to the variable URLis, simply put. I am somewhat of a newb in both html and javascript, so please keep as simple as possible. Do you have any suggestions or ideas for a way to set the iframe src as URLis variable?
Thank you.
Share Improve this question asked Nov 30, 2012 at 23:54 user1851853user1851853 371 silver badge4 bronze badges 3- Why cant you just target your link to that iframe? – jtheman Commented Dec 1, 2012 at 0:02
- sorry, I don't know what that means – user1851853 Commented Dec 1, 2012 at 0:40
- You probably mean your question... :) – jtheman Commented Dec 1, 2012 at 2:09
1 Answer
Reset to default 4Try this:
var URLis = document.URLframe.Dest.value;
document.write('<center><iframe src="' + URLis + '" width=1350 height=500 seamless></center>');
本文标签: HTMLset iframe src as a javascript variableStack Overflow
版权声明:本文标题:HTML, set iframe src as a javascript variable - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745382293a2656218.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论