アプリ版:「スタンプのみでお礼する」機能のリリースについて

かなりの素人なので説明不足などで分かりづらいところが多々あると思いますが、
何卒宜しくお願い致します。

同じhtmlに複数のiframeがあるのですが、
その全てのiframeをランダムにしたいのですが、
あまりの素人なので全く分かりません。

申し訳ありませんが、
多少いじってコピペするくらいまでのソースを教えて頂けますでしょうか?
宜しくお願い致します。

iframe一つだけのランダムは以下のソースでできました。



<head>


<script type="text/javascript">
<!--
function RndmSubFlame(){
rlURL= new Array();
rlURL[0]="01.html"
rlURL[1]="02.html"
rlURL[2]="03.html"

n=rlURL.length;
x=Math.floor(Math.random()*n);
sub_flame.location.href = rlURL[x];
}
//-->
</script>

</head>


<body TopMargin=0 LeftMargin=0 RightMargin=0 BottomMargin=0 STYLE="overflow:auto;height:100%;" onLoad="RndmOpen()">

<script><!--
document.write("<iframe src=\""+riURL[x]+"\"></iframe>");
//-->

</body>


以下のhtmlのようなページです。
できましたら、このソースに書き加え頂けますと
大変助かります。
宜しくお願い致します。



<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=shift_jis">
<title></title>
</head>

<body>

<table border="1" width="84%" height="87">
<tr>
<td width="33%" height="81"><iframe src="a01.html" frameborder="0" width="100%" height="190" name="01" scrolling="no"></iframe></td>
<td width="33%" height="81"><iframe src="a01.html" frameborder="0" width="100%" height="190" name="02" scrolling="no"></iframe></td>
<td width="34%" height="81"><iframe src="a01.html" frameborder="0" width="100%" height="190" name="03" scrolling="no"></iframe></td>
</tr>
</table>

</body>

</html>

A 回答 (2件)

No.1の者です。



↓のソースは一部誤りがありましたので訂正します。(インラインフレーム名の先頭に適当な数字以外が必要でした。)

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=shift_jis">
<title></title>
<script type="text/javascript">
<!--
function RndmSubFlame(){
rlURL= new Array();
rlURL[0]="01.html"
rlURL[1]="02.html"
rlURL[2]="03.html"

n=rlURL.length;
x1=Math.floor(Math.random()*n);
x2=Math.floor(Math.random()*n);
x3=Math.floor(Math.random()*n);
s01.location.href = rlURL[x1];
s02.location.href = rlURL[x2];
s03.location.href = rlURL[x3];
}
//-->
</script>
</head>
<body onload="RndmSubFlame()">
<table border="1" width="84%" height="87">
<tr>
<td width="33%" height="81"><iframe src="a01.html" frameborder="0" width="100%" height="190" name="s01" scrolling="no"></iframe></td>
<td width="33%" height="81"><iframe src="a01.html" frameborder="0" width="100%" height="190" name="s02" scrolling="no"></iframe></td>
<td width="34%" height="81"><iframe src="a01.html" frameborder="0" width="100%" height="190" name="s03" scrolling="no"></iframe></td>
</tr>
</table>
</body>
</html>

ですがこの方法だと最初に移動音がでますのでこちらのほうがひょっとしたらいいかも知れません。

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<title></title>
<script type="text/javascript">
<!--
rlURL= new Array();
rlURL[0]="01.html";
rlURL[1]="02.html";
rlURL[2]="03.html";
tw=new Array(33,33,34);
function xRandomFrame(){
doc="<table border='1' width='84%' height='87'><tr>";
for(i=0;i<3;i++){
doc+="<td width='"+tw[i]+"' height='81'><iframe src='"+rlURL[Math.floor(Math.random()*rlURL.length)]+"' frameborder='0' width='100%' height='190' name='0"+(i+1)+"' scrolling='no'></iframe></td>";
}
doc+="<tr></table>";
document.getElementById("field").innerHTML=doc;
}
//-->
</script> </head>
<body onload="xRandomFrame()">
<div id="field"></div>
</body>
</html>
    • good
    • 0

3セット作ればいいのではないでしょうか?



<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=shift_jis">
<title></title>
<script type="text/javascript">
<!--
function RndmSubFlame(){
rlURL= new Array();
rlURL[0]="01.html"
rlURL[1]="02.html"
rlURL[2]="03.html"

n=rlURL.length;
x1=Math.floor(Math.random()*n);
x2=Math.floor(Math.random()*n);
x3=Math.floor(Math.random()*n);
01.location.href = rlURL[x1];
02.location.href = rlURL[x2];
03.location.href = rlURL[x3];
}
//-->
</script>
</head>
<body onload="RndmSubFlame()">
<table border="1" width="84%" height="87">
<tr>
<td width="33%" height="81"><iframe src="a01.html" frameborder="0" width="100%" height="190" name="01" scrolling="no"></iframe></td>
<td width="33%" height="81"><iframe src="a01.html" frameborder="0" width="100%" height="190" name="02" scrolling="no"></iframe></td>
<td width="34%" height="81"><iframe src="a01.html" frameborder="0" width="100%" height="190" name="03" scrolling="no"></iframe></td>
</tr>
</table>
</body>
</html>
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!