hi You can make use of global variable to access user id in vf page as {!$User.Id} For more information please go through https://www.salesforce.com/us/developer/docs/pages/Content/pages_variables_global_user.htm
If you are trying to access it in your JS function you can do somthing like
<apex:page controller="myController">
<script>
function myJSFunction(){
alert('{!userid}');
//your js code
}
/** Controller **/
public with sharing class myController{
public String userid{get;set;}
public myController(){
userid = Userinfo.getUserId();
}
//your code
}
You can make use of global variable to access user id in vf page as {!$User.Id}
For more information please go through https://www.salesforce.com/us/developer/docs/pages/Content/pages_variables_global_user.htm
If you are trying to access it in your JS function you can do somthing like Thanks
Mark it Best answer if it helps you :)