cobweb[f_,start_,range_,n_]:=Show[{Plot[{x,f[x]},Evaluate[Prepend[range,x]],PlotRange->{range,range}],ListLinePlot[ Prepend[Join@@
({#,{Last[#],Last[#]}}&/@Partition[NestList[f,start,n],2,1]),{start,0}],PlotStyle->Dashed,PlotRange->{range,range}]},AspectRatio->1]

cobweb[#^2 &,.7,{-1,1},20]