Today, the interesting question is that the SharePoint survey, which adds support for the pictures, is well known to all that the SharePoint survey supports several types of field problems, of course, we can develop them, but this is not what we introduced today, We introduce today is JS implementation of the code-free development.
Below, look at the effect we want to implement, the following figure (the page to participate in the survey, in fact, this is the page I have done):
As pictured above, with the option of the picture, in the SharePoint field is very difficult to achieve, so, I want to put the IMG tag on the page, and then found as text output to the page, I thought of using JS script, replace the IMG tag, so I changed the contents of the investigation inside the options, As shown in the following figure (Survey options):
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/web/sharepoint/
Detailed text for the option:
#img_start width="100" height="120" src="http://10.5.92.11/bmdh/jyglb/DocLib/山居秋暝.jpg" #img_end 张三
#img_start width="100" height="120" src="http://10.5.92.11/bmdh/jyglb/DocLib/山居秋暝.jpg" #img_end 李四
#img_start width="100" height="120" src="http://10.5.92.11/bmdh/jyglb/DocLib/山居秋暝.jpg" #img_end 王五
As above text, I put the IMG tag before and after, with #img_start and #img_end replaced, so it is also convenient for us to use the JS script replace replacement, JS script attached, interested can refer to the following:
<script type="text/javascript">
var divobj = document.getElementsByTagName("LABEL");
for(var i=0;i<divobj.length;i++)
{
if(divobj[i].innerHTML.indexOf("#img_start")>=0)
{
var str = divobj[i].innerHTML;
str =str.replace("#img_start"," str =str.replace("#img_end","></img>");
divobj[i].innerHTML=str;
}
}
</script>
Add a Content Editor Web Part to the page, and then put the script in, click OK, find the effect we want to achieve, and then, the same JS script to achieve the survey of the statistics page (pictured below), here I will not much nonsense, we directly see the effect bar.
PostScript: Originally is a very simple idea, I want to share these to everyone. With more and more developers now in SharePoint, my philosophy remains that, unless you must, you don't know the code. Of course, this problem also has code implementation, link I attached, we can compare the two ways of implementation. Oh, very late, sleep. Good night, everyone.
Attach custom field implementation: http://blog.csdn.net/cxx2325938/article/details/8284741