In my book they say that if f:A->B is a surjection then f[A]=B,
but the definition is that for all b in B there is an element a in A sucht that f(a)=b. So we can have A={1,2,3} and B={2,3} then f(x)=x is a surjection but f(A) is not B. Am I correct?
No. f(x)= x is not "f:A-> B" because f(1)= 1 is not in B. If f:A->B, then f(A) must be a subset of B. That is, without any reference to "surjective", the notation f:->B implies that f(x) is in B for all x in A. "surjection" then implies the other way around: that B is a subset of f(A). Those two together, f(A) is a subset of B and B is a subset of f(A) say that f(A)= B.