javascript
  • variables
  • embed
  • 2012-05-25 59 views 0 likes 
    0

    我有當我點擊計算按鈕添加要的onclick顯示在嵌入式對象變量

    <script type="text/javascript"> 
    function ln(){ 
    document.getElementById('looknorth').innerHTML='<embed bgcolor="#dbdbd3" flashvars="lcId=1169793726234&amp;state=symbol%3D%5Ensebank;range=1d;indicator=ema(13,34,55)+macd+rsi+stochasticfast;charttype=candlestick;crosshair=on;ohlcvalues=0;logscale=on;source=undefined" loop="false" menu="false" name="BANKNIFTY" pluginspage="http://www.macromedia.com/go/getflashplayer" src="http://us.js2.yimg.com/us.yimg.com/i/us/fi/yfc/swf/flashchart_1.18.swf" style="height: 775px; width: 550px" type="application/x-shockwave-flash" wmode="opaque"></embed>'; 
        }  
    </script> 
    <input type=button style="background-color:#123742; color:#FFFFFF ; font-weight:bold; font-size:15" name=Button2 value=Calculate onClick=ln();></td></tr> 
    

    我想有一個drodown菜單這需要符號的值whhich被detting顯示嵌入式代碼「符號%3D %5Ensebank;」從下拉菜單的值。

    我添加的代碼

    <select size="1" name="D1"> 
    <option value="nsei" selected>Nifty</option> 
    <option value="bsen">Sensex</option> 
    </select><input type="submit" value="Submit" name="B1" onClick=ln();></p> 
    

    ,但什麼樣的變化在嵌入式代碼,以從D1取符號值

    請幫助

    <div id="looknorth"></div> 
    <script type="text/javascript"> 
    function ln(vidvar){ 
    
    tempcell = document.createElement("embed"); 
    tempcell.setAttribute("bgcolor","#dbdbd3"); 
    tempcell.setAttribute("flashvars", 
    ("lcId=1169793726234&amp;state=symbol=" 
    +vidvar+ 
    ";range=1d;indicator=ema(13,34,55)+macd+rsi+stochasticfast;charttype=candlestick;crosshair=on;ohlcvalues=0;logscale=on;source=undefined") 
    ); 
    tempcell.setAttribute("loop","false"); 
    tempcell.setAttribute("menu","false"); 
    tempcell.setAttribute("name","Bank Nifty"); 
    tempcell.setAttribute("pluginspage","http://www.macromedia.com/go/getflashplayer"); 
    tempcell.setAttribute("src","http://us.js2.yimg.com/us.yimg.com/i/us/fi/yfc/swf/flashchart_1.18.swf"); 
    tempcell.setAttribute("style","height: 775px; width: 550px"); 
    tempcell.setAttribute("type","application/x-shockwave-flash"); 
    tempcell.setAttribute("wmode","opaque"); 
    
    
    document.getElementById('looknorth').innerHTML="" 
    document.getElementById('looknorth').appendChild(tempcell); 
    

    }

    <form name="Video" id="search" onsubmit="ln(search.D1.value)"> 
    
    <select size="1" name="D1"> 
    <option value="^nsei" selected>Nifty</option> 
    <option value="^bsesn" >Sensex</option> 
    </select> 
    
    <input type="submit" value="Submit" name="B1" onClick=ln();> 
    

    我試圖去掉代碼但仍然無法正常工作。請幫助

    +0

    此外,你不應該問這樣的問題3次這樣的... –

    回答

    0

    您需要將它們放在窗體標籤中。

    <form name="Video" id="search" onsubmit="ln(search.D1.value)"> 
    
    <select size="1" name="D1"> 
    <option value="nsei" selected>Nifty</option> 
    <option value="bsen" >Sensex</option> 
    </select> 
    
    <input type="submit" value="Submit" name="B1" /> 
    
    </Form> 
    

    然後,改變LN(),所以它需要一個變量,這樣也許嘗試:

    <script type="text/javascript"> 
    function ln(vidvar){ 
    
    tempcell = document.createElement("embed"); 
    tempcell.setAttribute("bgcolor","#dbdbd3"); 
    tempcell.setAttribute("flashvars", 
        ("lcId=1169793726234&amp;state=" 
        +vidvar+ 
        ";range=1d;indicator=ema(13,34,55)+macd+rsi+stochasticfast;charttype=candlestick;crosshair=on;ohlcvalues=0;logscale=on;source=undefined") 
        ); 
    <!-- And so on for the rest of the attributes of the <embed> tag --> 
    document.getElementById('looknorth').innerHTML="" 
    document.getElementById('looknorth').appendChild(tempcell); 
        }  
    </script> 
    

    有可能是在此的一些bug但這是一般的想法。

    +0

    thans的偉大的幫助。可以請你幫我完成代碼tempcell.setAttribut爲整個嵌入代碼...我發現一個購買,我已糾正... tempcell.setAttribute(「flashvars」, (「lcId = 1169793726234 & state =」代碼= + vidvar + – user1417852

    +0

    treid你說的話,併發布修改後的代碼仍然無法正常工作,請幫助,也可以刪除代碼 – user1417852

    +0

    你添加了其餘的代碼嗎什麼是不工作?你得到什麼標籤? –

    相關問題