How can I get the text inside an object element?
问题 In the object element with the ID x a text file is loaded and displayed correctly. How can I get this text with JavaScript? I set y.data = "prova.txt" then tried y.innerHTML; y.text; y.value; None of these work. <!DOCTYPE html> <html> <head> </head> <body> <object id="x" data="foo.txt"></object> <script> var y = document.getElementById("x") </script> </body> </html> 回答1: I'm afraid this isn't going to be easy as you'd like it to be. According to your comments, you tried AJAX first, but came