Everything works fine in IE and Google Chrome, which is very frustrating. I have tried many ways to call functions in iframe, but the problem has not been solved. I searched again on Google today, patiently browsed the search results, and finally found someone who wrote that you can use
document.getElementById('iframeid').contentWindow.myFunc();
like this I have never seen this way of writing before, so I tried this code with the mentality of treating a dead horse as a living horse doctor. A miracle happened and the medicine cured the disease. Now this method works fine in the three browsers mentioned earlier. Make a note here for future reference.