2017-04-11 6 views
1

私は3種類のインデックス(indexsc/indexol/indexsa)に保存された3種類のチャート(同じタイプが異なるものを示す)を持っています。Htmlの更新チャート時にボタンクリック

は、新しいウィンドウを毎回開く必要がなくて、ボタンから選ばれたグラフでページを更新またはリロードすることが可能ですか?この

私の理解では、3種類のサブコードを呼び出すコアコードです。

<form> 
    <input type="button" value="Chart SC" onclick="window.open('indexsc.html', 'height=600, width=800, top=90, left=350, toolbar=no, menubar=no, location=yes, resizable=yes, scrollbars=yes, status=no');"> 

    <input type="button" value="Chart OL" onclick="window.open('indexol.html', 'height=600, width=800, top=90, left=350, toolbar=no, menubar=no, location=yes, resizable=yes, scrollbars=yes, status=no');"> 

    <input type="button" value="Chart SA" onclick="window.open('indexsa.html', 'height=600, width=800, top=90, left=350, toolbar=no, menubar=yes, location=yes, resizable=yes, scrollbars=yes, status=no');"> 

</form> 

答えて

0

iframeを使用できます。もちろん、JavaScriptを組み合わせました。あなたはこのようにすることができます。

JS

function getpage(y){ 

var x=y; 

    if(x=="one"){ 

     document.getElementById("one").src="page4.html"; 
    } 

    if(x=="two"){ 

     document.getElementById("two").src="page2.html"; 
    } 

    if(x=="three"){ 

     document.getElementById("three").src="page3.html"; 
    } 


} 

HTML

<form> 
    <input type="button" value="Chart SC" onClick="getpage('one')"> 

    <input type="button" value="Chart OL" onclick="getpage('two')""> 

    <input type="button" value="Chart SA" onclick="getpage('three')""> 

</form> 


<div class="column"> 


<div class="row chartone"> 

<iframe id="one" src="page1.html" height="200" width="300"></iframe> 

</div> 


<div class="row charttwo"> 

<iframe id="two" src="page2.html" height="200" width="300"></iframe> 

</div> 

<div class="row chartthree"> 

<iframe id="three" src="page3.html" height="200" width="300"></iframe> 

</div> 

</div> 

それは

を助けている場合、ボタンは

投票をクリックしたときに、今あなたが...あなたのページの読み込みを操作することができます

関連する問題