Calling external file by Div

Asked

Viewed 421 times

1

In the script below it is possible to call an external file through this <div>

<div id="script" class="#"></div>

Watch this excerpt from the script:

https://'+id+'?=

how do I make it through <div>

<div id="script" class="#">
</div>  

especially the part class="#" is the area responsible for calling the script '+id+'

Here is the script:

function (obj) {
    document.getElementById('script').appendChild(get_embed(obj['feed']['media']['content']));
}

var ts = Math.round((new Date()).getTime() / 1000);

var script = document.createElement('script');
script.src = 'https://'+id+'?'+(Math.round(ts/3600)).toFixed();

document.body.appendChild(script);

1 answer

2


Have you ever tried to capture the ID this way? If there is only one <div> with this ID, this is the easiest way to do.

function picasa_callback(obj) {
    document.getElementById('script').appendChild(get_embed(obj['feed']['media']['content']));
}

var ts = Math.round((new Date()).getTime() / 1000);

// Adicione ESTA linha para capturar o ID desejado:
var id = document.getElementById('script').className;

var script = document.createElement('script');
script.src = 'https:/'+id+'?'+(Math.round(ts/3600)).toFixed();

document.body.appendChild(script);

  • sorry, I managed to do now, had an extra code in the script, thanks for the help

Browser other questions tagged

You are not signed in. Login or sign up in order to post.