-
Posts
5 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by Agantacroxi
-
-
Whoops you're right works now thanks
-
Hm, it strangely doesn't work...Insert this text in the Try it Editor:
<!DOCTYPE html><html><head><script>function getIDext(){window.open("default.asp");n.onload = function() { var data = n.document.getElementById("translate_link").innerHTML; document.getElementById("idname2").innerHTML = data;}}</script></head><body> <h1 id="idname2">Try</h1><form><input type="button" value="click" onclick="getIDext()" /></form></body></html>
-
Thanks for your quick response.I need to load the data from an HTML file. Your script strangely doesn't work for me, it opens a tab with the file and stops.Here is how I wrote my script:
function useexternal(){var n = window.open("file.html");var el = n.document.getElementById("idname").innerHTML;document.getElementById("idname2").innerHTML = el}
In the document:
<p id="idname2">Lorem ipsum</p><form> <input type="button" value="Click me" onclick="loadfile()" /></form>
It just opens the file without changing "Lorem ipsum" into the content of the idname id in file.html... What did I do wrong?And is it possible to perform this task without opening file.html each time? Thanks!
-
Hello,I have a question: how do you define the document object to be not the current one, but an external one? Even with AJAX?What I want to do is take the content of a certain ID, located in an external file.Like
var varname = document.getElementByID("idname").innerHTML
but document is not the current document.Is it possible? :blink:Thanks,Agantacroxi
External document as document?
in JavaScript
Posted · Edited by Agantacroxi
And why not...
The only real problem is that this is not very compatible. Chrome 18+, IE 10+, Firefox 11+, no Opera, no Safari, Firefox Mobile 11+, no other mobile browsers... Source: https://developer.mo..._XMLHttpRequest