Zhang Yaokun started his football career in 1998 with Dalian Shide, however due to an ankle fracture he struggled to establish himself within the team and it was only once he overcame his long term injury did he start to become a regular. He later became an integral member of the defense and helped Dalian in their dominance within Chinese football by winning the league titles in the 2001 season and the 2002 season as well as the Chinese FA Cup in 2001. After Dalian had a disappointing 2004 season, Vladimir Petrović came in as the new manager and would loan out Zhang to Sichuan Guancheng during the 2005 season where he quickly established himself as a key member of the team where they finished ninth. He returned to Dalian the following season where he continued to be a key member of the squad and would go on to become their captain.
After his impressive displays for Dalian Shide, Zhang was called up to the Chinese national team for the 2004 AFC Asian Cup where he made several appearances coming on as a substitute and playing in numerous positions in defence. He continue to be a regular member of the team that qualified for the 2007 AFC Asian Cup and during the tournament, he and Li Weifeng were the first choice centre-back pairing. After the unsuccessful tournament, the new manager Vladimir Petrovic decided to play Zhang at right-back, preferring him there.