English 中文(简体)
按钮点击事件时显示的嵌入式代码
原标题:Embedded code to be displayed on click event of button

我有一个显示雅虎图表的嵌入式代码

嵌入式代码是-

<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>

我希望在单击显示按钮时显示此嵌入式代码。

请推荐相关的javascript。

我试过这样的东西

<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>

通过引用互联网上发现的代码,但该代码不起作用。

最佳回答

这一行需要编辑:

document.getElementById( looknorth ).innerHTML= <embed ....</embed> ();

document.getElementById( looknorth ).innerHTML= <embed ....</embed> ;

paranthes不应该在那里,因为字符串不是函数。

首先使用所述id创建一个div,然后向其中添加内容:

<div id="looknorth"></div>

<script type="text/javascript">
function ln(){
document.getElementById( looknorth ).innerHTML= <embed....></embed> ;
  }
</script>
<input type="button" value="Show Chart" onClick="ln();" />
问题回答

暂无回答




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签