What does "$f$ is a function on $S$" mean? If somebody says "$f$ is a function on $S$", what do they mean?
Does it mean that $S$ is the domain of the function, the codomain, or both?
 A: $S$ is the domain.  This sentence doesn't specify the codomain of $f$; it would have to be determined from context.
A: When dealing with functions, one usually specifies "$f$ is a function from $X$ to $Y$" or "a function on $X$ into $Y$", or $f$ is a function $f:X\to Y$. In particular, a function $f$ is a subset of the cartesian product $X\times Y$ , that is, a relation from $X$ into $Y$, such that for every $x\in X$ there is a $y\in Y$ for which $(x,y)\in f$, and whenever $(x,y)\in f$ and $(x,y')\in f$ it follows that $y=y'$.  
That is, to every $x\in X$ there corresponds a unique $y\in Y$ such that $(x,y)\in f$. Note it can happen that for two different $x,x'\in X$, the pairs $(x',y)$ and $(x,y)$ are in $f$. 
We usually call $X$ the domain and $Y$ codomain, and we call the image of $A\subset X$ under $f$ to the subset $f(A)\subset Y$ whose elements are the points $y=f(x)$ with $x\in X$, or more precisely, to the subset $f(A)$ of points in $Y$ such that $(x,y)\in f$ for $x\in A$. As an example, let $f$ be a function $f:[-4,4]\to \Bbb R$ such that $(x,y)\in f$ whenever $y=x^2$. Then $f([-1,1])=[0,1]$ and $f([-4,0]) =[0,16]$  
Now, when it happens that "$f$ is a function from (on) $X$ to (into) $X$" or $f:X\to X$, we might say simply that "$f$ is a function on $X$" (recall how a relation $R$ is said to be a relation on $X$ when boths its range and domain are the same set). This means $f$ is a subset of the product $X\times X$ with the aforementioned conditions. In this case the both the domain and codomain are $X$, and the image of $X$ under $f$ will be a subset of $X$ itself.
As J.D. noted, this constraint can produce some problems and should be handled carefully: consider the correspondence $f$ such that $(x,y)\in f$ whenever $y=x^2$, on the set $[0,10]$. It is immediate that whenever we choose $x>\sqrt 10$ we wont be able to find an $y$ to map $x$ to. This misbehaviour is given a name, namely, we call $f$ a partial function from $X$ to $Y$ if $f$ is a function $f:X'\to Y$ such that ${\rm dom }\, f=X'\subset X$, that is, not every element of $X$ is mapped into $Y$. Note that $f:X'\to Y$ is a "good" function in its own right, and it is the worded specification of $X$ that is problematic.
As Nate has commented, it might also happen that we say $f$ is a function on $X$ when the codomain $Y$ is understood, such as $\mathbb C$ or $\Bbb R$, and we need only to specify what the domain is. The word mapping is used as a synonym with function in nonspecific contexts, but might be given a special definition in other areas, as he notes.
