I need to change the backgroundImage of a div in a parent iframe.
I can do it, but not in a useful way, I need to send the variable from the button.
At the moment I have the variable in the script.
<script>
function myFunction() {
window.parent.document.getElementById('seekerBase').style.backgroundImage = "url('http://www.floom.com/images/waveform_lotos.gif')";
}
</script>
<button type="button" onclick="myFunction()">Get the background image of div</button>
I need to send the image url from the button and not having it in the script.
I tried this and is not working.
<script>
function myFunction() {
window.parent.document.getElementById('seekerBase').style.backgroundImage = "url()";
}
</script>
<button type="button" onclick="myFunction('http://www.floom.com/images/waveform_lotos.gif')">Get the background image of div</button>
Thanks for your help. I am a newbie.
function myFunction(img) { ... }