how to clone html in new _blank page when i click
btn_change_folder_style_seg
btn_change_folder_style_raw
then content will be
<img src="./pic/web_show/3_seg/01.jpg" alt="">
<img src="./pic/web_show/3_seg/02.jpg" alt="">
and
<img src="./pic/web_show/3_raw/01.jpg" alt="">
<img src="./pic/web_show/3_raw/02.jpg" alt="">
now full code
<img src="./pic/web_show/3/01.jpg" alt="">
<img src="./pic/web_show/3/02.jpg" alt="">
<img src="./pic/web_show/3/03.jpg" alt="">
<input type="button" id="btn_change_folder_style_seg" value="style seg"></input>
<input type="button" id="btn_change_folder_style_raw" value="style raw"></input>
<script>
$(function() {
$('#btn_change_folder_style_seg').click(function() {
alert("style_seg")
var imagePath = $('img');
imagePath.attr('src', function(index, attr) {
if (attr) {
return attr.replace('3/', index + 1 + '_seg/');
}
});
});
$('#btn_change_folder_style_raw').click(function() {
alert("style_raw")
var imagePath = $('img');
imagePath.attr('src', function(index, attr) {
if (attr) {
return attr.replace('3/', index + 1 + '_raw/');
}
});
});
})
</script>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…