In SharePoint 2013, if you wanted to use JavaScript in a calculated column to open the URL in popup, here is the simple and quick method to achieve the result. Calculated column can render the HTML.
Add a column in your list/library, select its type as “Calculated” and add the following:
<script langauage="javascript">
function Openlink()
{
OpenPopUpPage('http://sitecollection/subsite/Lists/Tasks/AllItems.aspx');
}
</script>
You can modify it according to your requirements. Hope this will work.
Add a column in your list/library, select its type as “Calculated” and add the following:
="<ahref='javascript:OpenPopUpPage('http://sitecollection/subsite /Lists/Tasks/AllItems.aspx')'>Click Me</a>"
When I tested the above code, it didn’t work for me. When I inspect the html, I found that JavaScript breaks the URL part the script.
So, I added modified the HTML part is calculated column as follows:
="<a href='#' onclick= 'Openlink()'>Click Me</a>"
Now add a content query web part in the page and add the following script in it.
function Openlink()
{
OpenPopUpPage('http://sitecollection/subsite/Lists/Tasks/AllItems.aspx');
}
</script>
You can modify it according to your requirements. Hope this will work.