Display Element From Other Page On My Site With .document.getelementbyid
I have been searching about this subject now for quite a few days. And could not find a working or conclusive answer. What I want to do, is to simply display the (styled) summary o
Solution 1:
You could add jQuery to your page and use a simple construction:
$('.result-container').load('path/to/your/file.html #id_of_element_to_fetch');
An example chunk of code:
...
<body><divclass="result-container">There will be your content from some file.</div><p><aclass="result-loader"href="#"></a><scripttype="text/javascript">
$(".result-loader").click(function() {
//Replace path/to/your/file.html and #id_of_element_to_fetch with appropriate values
$('.result-container').load('path/to/your/file.html #id_of_element_to_fetch');
returnfalse;
});
</script></p></body>
...
And that string somewhere inside the <head>
tag:
<scripttype="text/javascript"src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
An example chunk of code with an autostart feature:
...
<body><divclass="result-container">There will be your content from some file.</div><p><aclass="result-loader"href="#"></a><scripttype="text/javascript">
$(document).ready(function() { //Launches the code below right after the initialization event//Replace path/to/your/file.html and #id_of_element_to_fetch with appropriate values
$('.result-container').load('path/to/your/file.html #id_of_element_to_fetch');
returnfalse;
});
</script></p></body>
...
Solution 2:
I assume you are using a hidden iframe?
This for example will thet the height of the style.. there are other things in the style
this.container.getElementsByTagName("YOUuniqueID")[0].style.(STYLE)
But you have to put an unique ID in the iframe
Try and use the built in debuggers in IE or Chrome to find what you want...
You can take a look at this for maybe some more info(its for cross domain) but there could be something taht helps you. You might even consider using jquery to access that data.
Post a Comment for "Display Element From Other Page On My Site With .document.getelementbyid"