pollResults = document.createElement('div'); pollResults.id = 'pollResults'; pollQuestion = document.createElement('div'); pollQuestion.id = 'pollQuestion'; pollQuestion.innerHTML = 'Are older women still dating younger men?'; pollResults.appendChild(pollQuestion); graph = document.createElement('div'); graph.id = 'piegraph'; pollResults.appendChild(graph); flashObj = document.createElement('embed'); flashObj.setAttribute('type','application/x-shockwave-flash'); flashObj.setAttribute('src','http://tools.rogersconsumerpublishing.com/polls.net/images/piechart.swf'); flashObj.setAttribute('width','300'); flashObj.setAttribute('height','300'); flashObj.setAttribute('id','flashObj'); flashObj.setAttribute('name','flashObj'); flashObj.setAttribute('menu','false'); flashObj.setAttribute('wmode','transparent'); flashObj.setAttribute('flashvars','val=198|35&col=003399|FFCC00'); graph.appendChild(flashObj); graphLegendLabel = document.createElement('div'); graphLegendLabel.id = 'graphLegendLabel'; graphLegendLabel.innerHTML = 'Legend'; graph.appendChild(graphLegendLabel); graphLegend = document.createElement('div'); graphLegend.id = 'graphLegend'; graph.appendChild(graphLegend); graphLegend_2 = document.createElement('div'); graphLegend_2.innerHTML = "" + "Yes (85%)"; graphLegend.appendChild(graphLegend_2); graphLegend_3 = document.createElement('div'); graphLegend_3.innerHTML = "" + "No (15%)"; graphLegend.appendChild(graphLegend_3); try{ document.getElementById('poll').appendChild(pollResults); } catch(err){ document.write('Missing div with id \'poll\'.'); }