innerhtml

svg innerHTML in firefox can not display

。_饼干妹妹 提交于 2019-12-01 23:14:06
i use innerHTML to add svg element,it works fine in chrome but in firefox it can not display; thanks so much for any ansower <!DOCTYPE html> <html> <head> <title>SVGInnerHTML demo</title> <meta charset="utf-8" /> <script src="svginnerhtml.js"></script> <script> alter = function () { var svg = document.getElementById('container'); svg.innerHTML = '<rect width="100" height="60" fill="green" />' + '<circle cx="10" cy="19" r="20" fill="blue"></circle>' + '<text x="15" y="20" fill="white">hello world</text>' + '<g transform="translate(0, 70)"><rect width="100" height="20" fill="yellow" /></g>'; } <

Node.innerHTML giving tag names in lower case

筅森魡賤 提交于 2019-12-01 19:55:51
I am iterating NodeList to get Node data, but while using Node.innerHTML i am getting the tag names in lowercase. Actual Tags <Panel><Label>test</Label></Panel> giving as <panel><label>test</label></panel> I need these tags as it is. Is it possible to get it with regular expression? I am using it with dojo (is there any way in dojo?). var xhrArgs = { url: "./user/"+Runtime.userName+"/ws/workspace/"+Workbench.getProject()+"/lib/custom/"+(first.type).replace(".","/")+".html", content: {}, sync:true, load: function(data){ var test = domConstruct.toDom(data); dojo.forEach(dojo.query("[id]",test)

Output disappeared Javascript simple innerHTML

瘦欲@ 提交于 2019-12-01 18:02:32
问题 I am new to javascript and on every simple thing i get some kind of problem but this seems un-solve-able to me. I googled and nothing simillar. After i input data into textbox and store it into variable, i print out variable in paragraph. Problem is that output i printed out disappears within less than second. Code seems to be normal, what might it be? It looks like c when you dont put getch(); Thanks in advance. <form>Unesite broj koji ce se ispisat kasnije.<br> <input type="text" id=

innerHTML replace does not reflect

一曲冷凌霜 提交于 2019-12-01 17:57:50
I have HTML something like this <div id="foo"> <select> <option> one </option> </select> </div> when I use document.getElementById('foo').innerHTML = document.getElementById('foo').innerHTML.replace("<option> one </option>", "<option> two </option>") ; The innerHTML get replaced but it does not get reflected in the browser. If I alert innerHTML I can see that it has been changed now but in the browser it still shows old option. Is there any way to make this change recognized by the browser ? Thanks in advance. works fine for me in Firefox 3.5 Working Demo EDIT: You must be using IE. You need

Render CSS for innerHtml using angular2

◇◆丶佛笑我妖孽 提交于 2019-12-01 17:43:14
I am trying to render a HTML template using innerHTML and a html + css string I get from SQL. Template string example: <html xmlns="http://www.w3.org/1999/xhtml"> <head><title>Template Name</title><style type="text/css"> p{ color:red; }</style> </head> <body> <h1>#headding#</h1> <p style="color:red;">#paragraph#</p><a href="#url#">#urltext#</a> </body> </html> Now it renders the HTML fine but it looks like it drops the style tags and just renders the text inside of it. Example of render: HTML render part: <div [innerHtml]="templateBody"> </div> Home.component.ts parts: @Component({ selector:

innerHTML inserts only [object HTMLDivElement]

五迷三道 提交于 2019-12-01 17:33:22
i want to insert a htmlsnippet into another html-element i tried it this way the html <div class="box1"> insert this html element </div> <div class="box2"> into this </div> the js var box1 = document.querySelectorAll(".box1")[0]; var box2 = document.querySelectorAll(".box2")[0]; console.log(box1); box2.innerHTML = box1; but it doesnt work it only insert [object HTMLDivElement], if i look at the console it puts out the correct html, what im doing it wrong? and yeah i dont want to use the $ libary ;) http://codepen.io/destroy90210/pen/MKQOwy thanks ;) innerHTML doesn't insert DOM nodes, just

CSS “inner-html” technique? [duplicate]

泪湿孤枕 提交于 2019-12-01 17:13:45
问题 This question already has answers here : How to CSS: select element based on inner HTML [duplicate] (7 answers) Closed 4 years ago . I was wondering if there was a way to query elements according to the word it contains. So, if I have: <div id="globalPageHeader"> <h1>Home</h1> </div> I want any #globalPageHeader h1 that has the word Home in it, to have a display property of none . Obviously this example wouldn't work, but I was wondering if there's something like it: #globalPageHeader h1

Why does my image not show up when I use Javascript innerHTML to call it?

谁说我不能喝 提交于 2019-12-01 17:05:36
I am pretty new to Javascript, and I was trying somethings out. I am using a function to load an image inside a table using innerHTML. But the image does not show up, unless I call alert("whatever") at the bottom of the function, then it shows up while the alert is visible. The code I am using is something like (the function is called from an external js file) <script> function show(){ document.getElementById('imageHolder1').innerHTML="<a href="#"><img='photos/picture.jpg' border=0/></a>"; } </script> <body> <input name="b1" type="button" value="pics" onclick="show()"/> <table><td id=

Save / restore selection on contentEditable AFTER modifying innerHTML

不羁岁月 提交于 2019-12-01 16:41:05
I know getting / setting cursor position in a contentEditable is damn near impossible. I don't care about knowing this information. I need to be able to save current selection, modify innerHTML of the div, and then restore the selection. I've bee experimenting with the answer provided at contenteditable selected text save and restore . It works after typing in the div, but not after programmatically modifying the innerHTML of the div. Instead, when I call restoreSelection, the caret simply goes to the beginning. Any suggestions as to how to be able to save / restore selection on a

innerHTML works in IE and Firefox, but not Chrome

天涯浪子 提交于 2019-12-01 15:52:45
问题 The data will not display in Chrome, unless i open an IE tab in Chrome go to the site then close it back to Chrome (sorry, if that doesn't make much sense). window.onload = function() { var url = "http://----.freeiz.com/gbSales/sales.json"; var request = new XMLHttpRequest(); request.open("GET", url); request.onload = function () { if (request.status == 200) { updateSales(request.responseText); } }; request.send(null); } function updateSales(responseText) { var salesDiv = document