10 lis 2017

Odczyt atrybutów elementu w obsłudze zdarzena w javascript

<select name="banner_url" onchange="var idx=this.selectedIndex; 
var value=this.options[idx].getAttribute('banner_url'); 
var element = document.getElementById('img_banner_url'); 
element.setAttribute('src', value); element.style.display='block'">

!{section name=ii loop=$data}!
	!{capture assign=banner_url}!http://kody.wig.pl/!{/capture}!
	<option value="!{$banner_url}!" banner_url="!{$banner_url}!">
	!{$data[ii].name}! ---> !{$banner_url}!</option>
!{/section}!

</select>
<br><br>

<img src="" id="img_banner_url" style="display:none">