This is the code I am using now:
$(document).ready(function(){
$('#btn2').click(function(){
$('iframe').contents().find('body').css('background-image', 'url(http://mk7vrlist.altervista.org/backgrounds/1.png)');
$('iframe').contents().find('body').css('opacity', 1.0);
});
});
And here's the HTML:
<select onchange="bg(this[this.selectedIndex].value);">
<option value="0.png" id="btn1">1. Default skin</option>
<option value="1.png" id="btn2">2. MK7 Collage</option>
<option value="1.png" id="btn3">3. Solid Queen</option>
</select>
When I click the 2. MK7 Collage, as you can see in my jQuery function, the background of my iframe changes.
I have 3 option values and each one has a different background and id. I'd like to change them everytime a 'option value' is clicked. It's like:
$('#the_optionvalue_id').click(function(background_image_url){
$('iframe').contents().find('body').css('background-image', 'url(background_image_url)');
$('iframe').contents().find('body').css('opacity', 1.0);
});
I am pretty new with jQuery and I don't know how to set the id (the_optionvalue_id) and the background_image_url every time that a option is selected. Any help?