如何在一个文件中用JavaScript和HTML代码定义命名框架? [英] How do I define named frames with JavaScript and HTML code in one file?
本文介绍了如何在一个文件中用JavaScript和HTML代码定义命名框架?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有2个文件,想要合并它们.我对框架不满意,厌倦了反复试验.反复试验是我如何使该项目的其余部分正常工作的原因.
我在浏览器中加载的文件是:
I have 2 files and would like to combine them. I''m not good with frames and tired of trial and error. Trial and error is how I got the rest of this project to work.
The file I load in my browser is:
<br />
<html><br />
<br />
<frameset rows="125px,*"><br />
<br />
<!-- change the source to the file location --><br />
<frame src="file:///C:/Documents%20and%20Settings/ajester/My%20Documents/programming/frames/formDigits.htm"><br />
<br />
<frame src="http://www.google.com/search" name="showframe"><br />
</frameset><br />
<br />
</html><br />
<br />
它加载的文件是:
The file it loads is:
<br />
<pre><br />
<html><br />
<head><br />
<script type="text/javascript" language="JavaScript" src="ee.js"></script><br />
<br />
<script Language="Javascript"><br />
<br />
function BuildURL(){<br />
//var MyURLField = new String();<br />
var MyURLField = ''<a href="http://en.wikipedia.org/wiki/'';<br />
MyURLField = MyURLField.concat(document.getElementById(''myText'').value);<br />
MyURLField = MyURLField.concat(''" target="showframe">Wiki</a>'');<br />
document.getElementById(''span1'').innerHTML = MyURLField;<br />
//alert("build: " + MyURLField); //debug<br />
<br />
var MyGoogleURL = ''<a href="http://www.google.com/search?q='';<br />
MyGoogleURL = MyGoogleURL.concat(document.getElementById(''myText'').value);<br />
MyGoogleURL = MyGoogleURL.concat(''" target="showframe">Google's</a>'');<br />
document.getElementById(''spanG'').innerHTML = MyGoogleURL;<br />
}<br />
</script><br />
<br />
</head><br />
<br />
<body class="thebody"><br />
<span align="center"><form name= getData><br />
Enter Search String: <br />
<input type=''text'' id=''myText'' onkeyup=''BuildURL()''/><br />
</form></span><br />
<br />
<span id="spanG"><a href="http://www.google.com/search?q=junk" target="showframe">google's</a> </span><br />
<span id="span1"><a href="http://en.wikipedia.org/wiki/Test" target="showframe">Wiki</a></span><br />
<a href="http://etc.com" target="showframe">etc</a><br />
<a href="http://etc.com" target="showframe">etc</a><br/><br />
<br />
</body><br />
</html><br />
</pre><br />
Thanks in advance!
推荐答案
您不能将框架集文件与内容文件结合在一起.
如果框架集文件与内容文件位于同一目录中,则是一回事;
You can''t combine a frameset file with the content file.
One thing though if the frameset file is in the same directory as the content file you could use;
<html>
<frameset rows="125px,*">
<frame src="formDigits.htm">
<frame src="http://www.google.com/search" name="showframe"> </frameset>
</html>
感谢Rod!
HTML中还有其他可以代替框架集使用的东西可以给我同样的效果吗?我可能会从网络共享而不是从Web服务器运行最终版本,因此是file:///URL.
我将代码投入使用并放置在网络共享上,可以真正看到IE7和FF3.5之间的区别. :omg:
Thanks Rod!
Is there something else in HTML I can use instead of frameset that would give me the same effect? I''ll probably be running the final version from a network share not a web server hence the file:/// URL.
I brought the code to work and placed on a network share and can really see the differences between IE7 and FF3.5. :omg:
尝试一个IFRAME,此示例 [ ^ ]似乎在显示您要实现的目标.
Try an IFRAME, this example[^] would appear to show what you are trying to achieve.
这篇关于如何在一个文件中用JavaScript和HTML代码定义命名框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文