Finding Document URL
Jul 23, 2005How can I findouf the URL that the webpage came from?
Like document.address or something?
How can I findouf the URL that the webpage came from?
Like document.address or something?
I've tried to look for document.layers in Netscape 7 and couldn't get it... Here's the script:
Code:
var NS6 = (document.layers) ? 1 : 0;
var IE = (document.all) ? 1 : 0;
function bananas() {
if (IE)
alert("this is IE");
else if (NS6)
alert("this is NS6");
else
alert("bananas");
}
I'm only concerned with IE 5.5 or higher, and Netscape 6.2 or higher. In IE, it gives me the right stuff. But in Netscape 7 it gives me "bananas" (I haven't tried in Netscape 6.2) Why doesn't it work?
Suppose a HTML document has a iframe. Using javascript,I want to detect ,on load of the html document, whether the body of the iframe document is ready to be displayed.I want to be able to overwrite the the body contents (before it actullay loads) of the iframe.can I do it with jquery? say if ,HTML doc is
Code:
<html><head></head><body><iframe id="ifrmId" src="http://www.google.com" ></iframe></body></html>
i want to save my html document as an microsoft word document will
View 14 Replies View RelatedNormally an SVG document is loaded/parsed/interpreted inside an HTML
document using an 'object' (or 'embed') element, although there are
supposedly other ways too. The problem is, the SVG document must be
static this way.
I want to use the DOM interface to build SVG dynamically inside an HTML
document. I am guessing I can build it inside HTML within an 'object' (or
maybe 'iframe'?) element.
My intentions/goals:
In Javascript, I construct an object 'embedSVG' which has properties and
methods for creating valid SVG elements and setting their attributes and
attribute values.
During construction, the SVG document is created with its root element.
During debugging in FF 2.0 (I'll work on an MSIE-compatible format later),
I am using the Mozilla DOM Inspector and comparing nodes when the
'object' element is loading a valid external SVG document, and when I am
appending the child representing the SVG document created by the DOM
functions.
However the child node (#document) does not specify 'svg' as the root
element, but instead 'HTML'. Something is not working.
Here is the relevant code in 'ScriptTest.html' which is the HTML in which
the SVG is supposed to be embedded. Below it is the relevant code for
'svglib.js' which is supposed to contain code for building the SVG
dynamically.
What this code is supposed to do is load the HTML page and execute the
anonymous script, and draw a navy blue-bordered yellow rectangle on a
blank page. This is similar to the example in the SVG 1.1 W3C
Recommendation on page 202 of the 719-page PDF.
I am getting an exception when embedSVG object placeInHTML() method is
called: NS_ERROR_DOM_HIERARCHY_REQUEST_ERR. I find in DOM Inspector in
spite of or after the exception that a document is placed as a child of
the object element, but it is HTML, with a default 'head', 'title',
'body' elements placed.
Where am I blowing it?
Determine what the previous page was that the user was viewing, even if the user arrived at my site by through the use of a browser function (history, location bar, refresh, etc.). Is this possible?
I'm not wuite sure how document.history functions - what degree of privacy is given to the user and to what extent can web pages get URLs from the user's history?
I am trying to make a function run if the mouse is moved over the document but when using the object onmousemove it seems to run the code even if the mouse is still over then document, how can I make it so if the mouse is over the document but isn't moving then don't run the code but once the mouse moves run the code? This is the code I made to handle the mouse move collections.
[Code]..
But with this code it runs even when the user doesn't move their mouse and the notification box pops up every second as the code seems to think a still mouse is a moving mouse.
I was thinking about having a run once system but that would mean if the mouse moves it runs once and then if the mouse moves again the code will not run as it has already ran before.
I want to switch a big function from a document.onkeydown = function to a document.onkeypress = function, or vice versa depeding on the type of browser.
However it is quite a big function so it's pretty much out of the question to have it appear in full twice.
Any ideas how to change the target event (onkeydown/onkeypress) without writing the whole function twice?
I am working on creating a document where you check a bunch of checkboxes to select what to include, then click on a button. A function then opens a new window and writes the HTML code to run scripts in .js files to populate the page. Code:
View 4 Replies View RelatedI have been searching for a way to trap changes done to the document object (mainly by the function document.write();).
Example of code that doesn't work:
function myFunction() {
ed.document.onchange = doFunction(document.body.innerHTML);
ed.document.open();
ed.document.write('Hello');
ed.document.close();
}
function do_function(body) {
alert(body);
}
It only fires when the page loads, not when I change the text. You are free to use any event that works, but i think onchange was the one to fit this problem. The alert will write the initialpage, but will never write the tekst 'Hello' that is the new change.
Any javagurus out there know a solution to pick up any fired events triggered by document.write();
I am trying to write a bunch of text onto a new document using document.write() and somehow need to format it to include line breaks.
For example:
Code JavaScript:
document.write(Line 1);
document.write(Line 2);
I have tried including and it does not work. I have also tried document.writeln() and that also does not work. From what I have found on the Internet, one (if not both) of those methods should have worked.
I have a div, which can be anywhere in the document. I want it like, when I click anywhere on the div, it tells me the X, Y of the mouse in the div. Like X mouse - X div (left) and Y mouse - Y div (bottom). So that I know the width and height of the mouse according to the div. Is it possible or cross browser?
View 9 Replies View RelatedI have a div which wraps a table. Initially, the div's display attribute is "none", basically I need to find the height of the table in the div, and use that information to render the div to the user. The div is rendered only on the users request.
View 1 Replies View RelatedThis is just some functionality missing in the Array object that I'd find very useful...
Array.prototype.inArray=function(oObject){
for(var i in this){
if(this[i]===oObject){
return true;
}
}
return false;
}
to use:
var oObj=new Object();
var aArray=[1,oObj,"string"];
aArray.inArray(1); // returns true
aArray.inArray(oObj); // returns true
aArray.inArray("string"); // returns true
aArray.inArray(2); // returns false
I want to be able to find the height of a div in pixels without defining it in JavaScript. The Div needs to be able to have whatever content in it is required, and it will change without a refresh. I have no idea what could possibly do this, I was hoping somebody with more experience with JavaScript could help me :D
It also really needs to be at least Internet Explorer, Firefox and Opera proof.
Title doesn't really give this thread justice ... I have a content div with an image and text included into it. This same div class is being used multiple times. What I want is to be able to click the image, and have the <p> in that div toggle to show or hide. Here is the XHTML code for the front-end:
<div class="content">
<img src="image_big.gif" alt="image" class="toggle_font" />
<p> Caption for the next image. </p>
[code]....
How can I get the position of an element such as a div?
View 2 Replies View RelatedI'm trying to make some changes to the Javascript portion of our
corporate intranet site and I'm trying to find if theres a way to find
the User's login id from a Javascript function?
If not, is there a way to run a 'echo %USERNAME%' from DOS command
window and obtain the output. I realize there's an inherent security
risk if Javascript were to allow that.
Am I barking on a completely wrong tree, is NTLM authentication what I
should be looking at?
Basically, I need to get the user id without the user having to supply
it on the page manually. Can this be automated?
I would like to check if a string is a valid zip code via Javascript.
Length and existents are already checked.
How can I find out if the string contains characters other than numbers?
Example: 834F7
schould be false since it countains an F character
How would I access the source of a webpage? I would like to get the source,
then use a regexp to find text on a webpage. For example, retrieving a
counter, or some other text that dynamically changes. I'm implementing this
for firefox.
right now, i have a web page opening that contains that info, but i would
rather have a pop up alert() that shows that info.
Say I have some CSS, which is several hundred lines long, with the
contents in this format:
..foo {
blah
color:#000;
blah
}
..bar {
blah
color:#FFF;
}
where the selectors and their opening braces, their closing braces, and
declarations are each on their own lines (always), how can I replace a
specific declaration (line) given a unique selector and a declaration
property. For example, if I wanted the 'color' declaration property line
in the 'bar' class changed.
At the moment I'm iterating through the CSS one line at a time looking
for the selector and then looking for the declaration property (before I
hit the closing brace).
Is there a way to get an array with every value of a list?
document.myform.myselect.options doesn't seem to work.
I have a link styled with css that I'd like to change with a mouse event. It's going to be on a touch screen so I'm assuming I should adopta mouseUp/mouseDown model?
[Code]..
i am creating a simple dynamic menu for my study with the following structure:
[Code]...
now i need to find the correct selector for the mouseout event, because now the submenu disappears if i am getting of the current element (this) of the mainmenu, but i only want it to disappear if it is not anymore over the submenu, or if the mouse goes over another element of the main menu.
I'm looking to grab the width of an <li>, including padding and margins that doesn't have a set width, and has one of 'auto' or 0.
View 5 Replies View RelatedI seem to be rather bad at formulating my questions, so let me try another way; given the following:
DOM:
DOCUMENT
HTML[code]....
How do I get/set that textarea value?