Total-reflection X-ray fluorescence (TXRF) has achieved remarkable success with the advantages of simultaneous multi-element analysis capability, decreased background noise, no matrix effects, wide dynamic range, ease of operation, and potential of trace analysis. Simultaneous quantitative online analysis of trace heavy metals is urgently required by dynamic environmental monitoring and management, and TXRF has potential in this application domain. However, it calls for an online analysis scheme based on TXRF as well as a robust and rapid quantification method, which have not been well explored yet. Besides, spectral overlapping and background effects may lead to loss of accuracy or even faulty results during practical quantitative TXRF analysis. This paper proposes an intelligent, multi-element quantification method according to the established online TXRF analysis platform. In the intelligent quantification method, collected characteristic curves of all existing elements and a pre-estimated background curve in the whole spectrum scope are used to approximate the measured spectrum. A novel hybrid algorithm, PSO-RBFN-SA, is designed to solve the curve-fitting problem, with offline global optimization and fast online computing. Experimental results verify that simultaneous quantification of trace heavy metals, including Cr, Mn, Fe, Co, Ni, Cu and Zn, is realized on the online TXRF analysis platform, and both high measurement precision and computational efficiency are obtained.