我已经定义了以下 JavaScript:-
<script type="text/javascript">
var html = ' ';
var i = 1 ;
if ( "#variable.1#" != null) {
html += '<div><a href="/Service1.svc/vf/img?imgid=#variable.1#" >"View Page" + i </a></div>';
i =i +1;
}
if ( "#variable.2#" != null) {
html += '<div><a href="/Service1.svc/vf/img?imgid=#variable.2#"> "View Page" i </a></div>';
i = i=1;
}
if ( "#variable.3#" !=null) {
html += '<div><a href="/Service1.svc/vf/img?imgid=#variable.3#" >"View Page" + i </a></div>';
i = i+1;
}
document.write(html);
</script>
但是如果所有变量都不为空,上述javascript的输出将是:-
"View Page" + i
"View Page" i
"View Page" + i
那么我如何强制输出为外部集成图像
View Page 1
View Page 2
View Page 3