i want to give anchor tag to an image while checking the condition in slide show where my slide show is displayed using script
<script type="text/javascript">
var res;
var hdnvalue = a = document.getElementById('HiddenField4').value;
var imgArr = hdnvalue.split(';');
var sp = [];
for (var count = 0; count < imgArr.length; count++) {
sp.push([imgArr[count], "", "", ""]);
}
var mygallery2 = new fadeSlideShow({
wrapperid: "fadeshow2",
dimensions: [568, 313],
imagearray: sp,
displaymode: {
type: '开发者_如何学Pythonauto',
pause: 2500,
cycles: 0,
wraparound: false
},
persist: false,
fadeduration: 500,
descreveal: "always",
togglerid: "fadeshow2toggler"
})
</script>
in this script i want to check the condition
'hdnLink' value->http://dev1.maxnet-tech.com/royalindustries/ProductList.aspx?s=4&sss1=17&sss2=3;;;
var cnLink = document.getElementById('hdnLink').value;
var cnSplit = cnLink.split(';');
var b = a.split(';');
if (cnSplit[0] != "") {
then add <a>tag th that image which is redirected to plroduclist page
}
else {
add img
}
how can i add tag to image acc to condition in an array like above script
Can you tell the value of document.getElementById('HiddenField4').value?
As per my assumption of the value, this can be solution
for (var count = 0; count < imgArr.length; count++) {
if(imgArr[count] != ''){var str = "<a href='URL to redirect'><img src='imgArr[count]'> border='0' /></a>";
} else{
var str = "<a href='URL to > redirect'><img src='imgArr[count]' > border='0' /></a>";
}
sp.push([str , "", "", ""]);}
i got the answer change sp.push([imgArr[count], "", "", ""]); to sp.push([imgArr[count], "http://www.gmail.com", "", ""]);
because the second parameter in this will be the link bye
精彩评论