Functional sheaf (Hartshorne, Cartier divisors) In Hartshorne there is the following description of the sheaf $K$ on the scheme.
For each open $U = Spec \,  A$ we define $K(U) = S^{-1} A$, where $S$ is the set of non-zero-divisors. Why is it a presheaf?
If we have $Spec \, B \subset Spec \, A$, why non-zero-divisor restricts to non-divisor?
If we have arbitrary ring homomorphism $A \rightarrow B$, then it can map non-divisor into divisor. Probably, we should use some property of the morphism $A \rightarrow B$, which give an open immersion $Spec \, B \rightarrow Spec \, A$.
 A: Slight alternative to what $QiL$ wrote, but roughly the same. On $Spec \; A$, let's put over $D_f = Spec \; A_f$ the ring $S^{-1} A_f$, where $S$ is the collection of non-zero-divisors. 
What should our restriction maps be? Well, we have $A \rightarrow A_f \rightarrow S^{-1} A_f$, so if we know a non-zero-divisor in $A$ maps to a non-zero-divisor in $A_f$, we get a restriction map via our universal property.
And sure enough, suppose $a \in A$ is not a zero divisor. Suppose we had $$\frac{a}{1} \cdot \frac{a'}{f^n} = \frac{0}{1} \Rightarrow f^Na' a = 0 \in A$$for some $N$, which means that in fact $f^N a' = 0$, hence $\frac{a'}{f^n} = 0$, as desired!
Great, now we have a nice presheaf on a base, but we can be even more explicit, namely give restriction maps and sections of our presheaf on arbitrary affine opens. For any open affine $Spec \; B \subseteq Spec \; A$, we have $A \rightarrow B \rightarrow S^{-1} B$, to get our restriction map we again just have to check that $a$ as before is a nonzero divisor. Indeed, suppose $a \cdot b = 0$ for some $b \in B$, now cover $Spec \; B$ by $Spec \; A_{f_i}$, we deduce $b$ restricts to 0 in each of them hence is 0. 
