Log in

View Full Version : how to use <frame> in this code?



alipour66m
01-17-2012, 02:49 PM
hello
how can i use <object> or <frame> instead of iframe in this code?

<script type="text/javascript">
{literal}
function RedirFrames(id1, url1, id2, url2, id3, url3, id4, url4)
{
document.getElementById('frame1').src = url1;
document.getElementById('frame2').src = url2;
document.getElementById('frame3').src = url3;
document.getElementById('frame4').src = url4;
}
{/literal}
</script>

</head>
<body id="body">

<center>

<iframe id='frame1' name="frame1" style="position: absolute; left: 0px; top: 0px;" width="49%" height="49%"></iframe>
<iframe id='frame2' name="frame2" style="position: absolute; right: 0px; top: 0px;" width="50%" height="49%"></iframe>

<iframe id='frame3' name="frame3" style="position: absolute; left: 0px; bottom: 0px;" width="49%" height="49%"></iframe>
<iframe id='frame4' name="frame4" style="position: absolute; right: 0px; bottom: 0px;" width="50%" height="49%"></iframe>
</center>

molendijk
01-18-2012, 01:25 AM
There are errors on your page. And <object> and <frame> are not suitable for what you want. Why not just use the iframe, which validates in HTML5! This works and validates:

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function RedirFrames(which_div1, url1, which_div2, url2, which_div3, url3, which_div4, url4)
{
document.getElementById(which_div1).src = url1;
document.getElementById(which_div2).src = url2;
document.getElementById(which_div3).src = url3;
document.getElementById(which_div4).src = url4;
}
</script>

<title></title>
</head>

<body><div>
<a href="javascript: void(0)" onclick="RedirFrames('iframe1', 'http://www.dynamicdrive.com', 'iframe2', 'http://www.webkit.com', 'iframe3', 'http://www.cryer.co.uk/resources/javascript/script8.htm', 'iframe4', 'http://www.cryer.co.uk/resources/javascript/script8.htm#SimpleForms')" >Load iframes</a>

<a href="javascript: void(0)" onclick="RedirFrames('iframe1', '', 'iframe2', '', 'iframe3', '', 'iframe4', '')" >Unload iframes</a>

<div style="position: absolute; left: 30px; top: 30px; right: 51%; bottom: 51%; "><iframe id='iframe1' name="iframe1" style="position: absolute; width: 100%; height: 100%" ></iframe></div>

<div style="position: absolute; left: 50%; top: 30px; right: 30px; bottom: 51%"><iframe id='iframe2' name="iframe2" style="position: absolute; width: 100%; height: 100%"></iframe></div>

<div style="position: absolute; left: 30px; top: 51%; right: 51%; bottom: 30px"><iframe id='iframe3' name="iframe3" style="position: absolute; width: 100%; height: 100%" ></iframe></div>

<div style="position: absolute; left: 50%; top: 51%; bottom: 30px; right: 30px"><iframe id='iframe4' name="iframe4" style="position: absolute; width: 100%; height: 100%"></iframe></div>

</div></body>

</html>
Arie Molendijk.

alipour66m
01-18-2012, 03:00 PM
thanks for your help
but i dont want to use iframe because google dont like iframes .
do you have a better solution?
what should i do?

molendijk
01-18-2012, 04:03 PM
If Google doesn't like iframes, then it will probably not like frames and text/html-objects either. And frames have issues that iframes don't have.
===
Arie.