Tagged Questions
30
votes
7answers
48k views
“Access is denied” JavaScript error when trying to access the document object of a programmatically-created <iframe> (IE-only)
I have project in which I need to create an <iframe> element using JavaScript and append it to the DOM. After that, I need to insert some content into the <iframe>. It's a widget that will ...
35
votes
7answers
40k views
Get entire document HTML as string
Is there a way in JS to get the entire HTML within the html tags, as a string?
document.documentElement.??
9
votes
4answers
5k views
javascript to get paragraph of selected text in web page
After highlighting text, I would like to obtain the paragraph in which the selected text resides.
var select = window._content.document.getSelection();
Any pointers please?
18
votes
1answer
13k views
Difference between screen.availHeight and window.height
I am executing the following Javascript on my browser (Firefox).
console.debug("Screen height = "+ screen.availHeight); //outputs 770
console.debug("Window Height ="+ $(window).height()); //outputs ...
7
votes
4answers
7k views
How do I execute a page-defined JavaScript function from a Firefox extension?
I'm creating a Firefox extension for demo purposes.
I to call a specific JavaScript function in the document from the extension.
I wrote this in my HTML document (not inside extension, but a page that ...
11
votes
11answers
12k views
Save the document generated by javascript
Javascript can manipulate the document the browser is displaying, so the following:
<script>
...
11
votes
4answers
5k views
What's the most concise cross-browser way to access an <iframe> element's window and document?
I'm trying to figure out the best way to access an <iframe> element's window and document properties from a parent page. The <iframe> may be created via JavaScript or accessed via a ...
18
votes
3answers
16k views
window.location vs. document.location [duplicate]
Possible Duplicate:
What's the difference between window.location and document.location in JavaScript?
In JavaScript, both window and document have a location property, and by setting ...
2
votes
2answers
5k views
HTML: Getting document from IFrame
I have this HTML code:
<:html:>
<:head:>
<:script type="text/javascript":>
function GetDoc(x)
{
return x.document ||
x.contentDocument ||
...
8
votes
4answers
5k views
How to create Document objects with JavaScript
Basically that's the question, how is one supposed to construct a Document object from a string of HTML dynamically in javascript?
4
votes
5answers
6k views
Why won't this JavaScript (using document.open and document.write) work in Internet Explorer or Opera?
I desperately need some help on this one.
I've created a <script> that closely parallels, and reproduces the problem of, another more complex <script> that I've written elsewhere.
Here's ...
6
votes
5answers
11k views
create a javascript document Object
Is there any way to create or recreate a javascript document Object by calling a function. Something like
<script type="javascript/text">
var document = createDocument("some html");
...
5
votes
2answers
512 views
General reasons not to deal with Document's and Element's prototype
Are there general reasons not to deal with Document's and Element's prototype?
I like to create my own little framework, because my current project doesn't need the mass of features of the existing ...
2
votes
4answers
5k views
How do I refer to the document object of an <iframe> from the parent page, using jQuery?
I'm trying to access the document object of a page that lives in an <iframe> from the host page. In other words, I have a page that has an <iframe> in it, and I want to use jQuery on that ...
31
votes
3answers
34k views
$(window).scrollTop() vs. $(document).scrollTop()
What's the difference between:
$(window).scrollTop()
and
$(document).scrollTop()
Thanks.
9
votes
4answers
517 views
$(document) vs. $(“document”)
Is there any difference between: $(document) and $("document")?
EDIT: also when into the .ready() e.g. $("document").ready()
3
votes
3answers
230 views
Determining the width of a webpage in inches
I have a CSS stylesheet that uses media queries to change how a page is displayed based on how many inches it is in width (for instance, if it is smaller than 4 inches or being displayed on a handheld ...
1
vote
3answers
452 views
can I show a specific part of a page using document.getElementById(href)?
if I have a page called "content page":
<body >
<p id="part1">Tread ... inch. </p>
<p id="part2">Tread ... inch. </p>
<p id="part3">Tread ... inch.</p>
...
0
votes
2answers
1k views
Confused by document dimensions in JavaScript
I am really confused by the different properties that exist in JavaScript for getting the dimensions of a document and how to get those numbers. Can someone recommend a good place to start to ...
5
votes
3answers
9k views
How to fire “onload” event on document in IE
I am currently developing Unit Tests for a Javascript method that detects the readiness of the document. This code is already at framework level, so please avoid mentions of this being already ...
3
votes
2answers
2k views
Javascript framework that primarily provides just document/onready functionality
A couple of months ago I was doing Javascript programming on the Facebook platform, on which the major frameworks such as Dojo, ExtJS, jQuery, Prototype, etc. don't necessarily work. Which led me to ...
2
votes
4answers
795 views
Create a DOM document from string, without JQuery
We're looking for ways to create a DOM document in javascript from a string, but without using Jquery.
Is there a way to do so? [I would assume so, since Jquery can do it!]
For those curious, we ...
0
votes
0answers
124 views
document.write and window.onerror weird interaction in Chrome
Somehow when an iframe is created with document.write, the line number for window.onerror that is given is relative to the script tag the code lives in.
Consider these fiddles: fiddle1 fiddle2. They ...
0
votes
2answers
2k views
How can I determine if the document.referrer is from my own site?
Each time a page is requested I get the referrer of the page it came from. I need to track just referrer from other sites, I don't want to track going from one page to another within my site. How can ...
0
votes
3answers
5k views
How to load jQuery before DOM is ready
I want to load some jQuery code before the DOM is ready. I want to make a flash file transparant as the DOM loads. I was going to use something like this but Flash is initilized before the DOM loads.
...
-2
votes
3answers
3k views
document.documentElement.clientHeight returning a greater value than document.body.clientHeight [closed]
i am doing some very simple javascript, so it seems rather silly to be asking such a basic question. I would appreciate if you will actually look at this seriously rather than bully me about being ...