get div element defined from a scriptlet using javascript

I have a web page that contains a scriptlet like

    <div id="flash_chart">
    <%=content_data['report_text']%>
    </div>

The variable content_data['report_text'] holds a long string which is actually some html and javascript code, shown as following

    <div id='Fusion_12345678'></div>
    <script type="text/javascript">
    <script class="fusioncharts" type='text/javascript'>
    if(!document.getElementById('id_chart_Fusion_1779126')){
    if(typeof(printRequest) === 'function') printRequest();
        window.chart_Fusion_1779126 = FusionCharts.render({
    swfUrl: 'http://localhost:8080/mysentry/assets/ireportpro      
    id: 'id_chart_Fusion_1779126',
    width: '100%',
    height: '450',
    debugMode: 0,
    registerWithJS: 1,
    renderAt: 'Fusion_1779126',
            ...
    </script>

On my web page, I tried to use document.getElementById('Fusion_12345678') to get the div defined from the scriptlet, but it does not work. Anybody knows how can I get that div 'Fusion-12345678' using javascript? Thanks for your help.

Answers


Got it. Access the <div> using childNodes on the parent div which is defined on the page:

document.getElementById("flash_chart").childNodes[1]

Need Your Help

changing to jruby, get RuntimeError: Server handler (thin) not found

sinatra jruby thin

My app works fine in MRI 1.9.2-p290 and 1.9.3-p125, but when I change to jruby-1.7.0-preview1 I get the error discribed. Here's the full error:

How to use Ansible's with_item with a variable?

ansible

I'm trying to transform some fields of the items of a list in an Ansible Playbook. Here is the simplest reproduction path, skipping the transformation. The result should be identical to the users