English 中文(简体)
将 Java印物体列入内装超文本
原标题:Adding Javascript objects into innerHTML

我的图像像以下。 (create(>;) 是我写的,但我知道这一功能。)

var img = 创造(“img”),“images/duba.jpg”;

当我试图将这一形象列入另一个物体的<条码>内温<>/代码”时,我拿到这个清晰文本,图像应当显示:

What s the correct method to insert one object into another like this? I have to think there s a more graceful method than hard-coding the innerHTML with strings, which I ve tried successfully.

最佳回答

电话:appendChild,将多功能元素与现有元素联系起来。

问题回答

你们应使用OMM操纵方法。 E.g.

我认为你需要使用:

otherObject.appendChild(img);

如果你正在制造一个要素,你可以把它当作一个 no子。 超文本,使用超文本。 正当使用

parent.appendChild ( create("img", "images/duba.jpg") );

使用<条码>应用方法。 The inner Rainbow/code> property received a string, not a DOM content.





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.