Question

J'ai créé une page ASPX personnalisée dans Visual Studio pour mon application SharePoint.Je souhaite utiliser la fonction JavaScript sur cette page personnalisée comme celle-ci:

function ChangeLanguage(value) {
    var today = new Date();
    var oneYear = new Date(today.getTime() + 365 * 24 * 60 * 60 * 1000);
    var url = window.location.href;
    document.cookie = "lcid=" + value + ";path=/;expires=" + oneYear.toGMTString();
    window.location.href = url;
}


<a href="javascript:ChangeLanguage(1053)"></a>

Mais, il n'est pas autorisé à mettre du code JavaScript dans la page personnalisée.Y a-t-il une possibilité de faire cela?

Était-ce utile?

La solution

Instead of writing the call in href, call it onclick event

function ChangeLanguage(value) {
    var today = new Date();
    var oneYear = new Date(today.getTime() + 365 * 24 * 60 * 60 * 1000);
    var url = window.location.href;
    document.cookie = "lcid=" + value + ";path=/;expires=" + oneYear.toGMTString();
    window.location.href = url;
}


<a href="#" onclick="javascript:ChangeLanguage(1053);">Change Language</a>
Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top