You will notice that the 'text' and 'selected' properties are marked as
read-only. This adds an interesting dilemma: how do you go about
programatically modifying these properties, especially considering the
need to assign to 'text' when creating a new object? Would you add a text
node, as you find in HTML, to represent the text displayed? If that is the
correct approach, it still leaves 'selected' inaccessible[1].
Something that I did notice is that the ECMAScript bindingsdon't mark any
properties as read-only, and assigning to 'text' is possible, certainly in
Opera. Is that because there is no concept of read-only, so the browser
can choose to ignore assignments, or some other reason?
In the example below it appears JavaScript can't read a style property if it's not specifically defined with JavaScript before, ie you can't get a value in this way:
Is there a way to read such style properties directly?
I have a menu that is made from a ul element (with li children).
Here is an example:
< ul id="menu" > < li><a href="#divEntire2">Home Page</a></li>
[Code].....
However, if I do something like $(this).css('background-color','maroon'), the text and a section of bar under it does turn maroon. This happens even I just click on the bar.
I've been working on a function to convert nodeList and object properties to an array. The first question is with regards IE and checking whether the object provided is an HTML collection. The best I have come up with so far, is to test if it's an object, has an 'item' which is a function and has length. The second question is with regards slice.call and a while loop copy. I guess I need to do some profile/timing tests, but I'm wondering if the function merits a slice.call? or should I simplify?
Code JavaScript: // Some weirdness in IE regarding nodesList and typeof 'item' returning 'Object' // even though when alerted it returns 'function (){...}'. // Therefore having to use regExp.test() to check whether it's a function instead. // Note: _isNodeList isn't full proof. An object with the properties [Code]..
how to add extra properties to html elements as I was storing data in html attributes. After looking at some others code including Raphael and this addEvent code. [URL] They seem to treat objects just like an array. obj[property] = value; This would have been extremely helpful to know previously as I have needed to be able to include variables in property names - but have resorted to making the whole thing a string and calling exec() on it.
Is there a way in Javascript or Jquery to return an array of all objects underneath a certain point, ie. the mouse position. Basically, I have a series of images which link to various web pages but I have a large semi transparent image positioned over the top of the other images. I want to find the href of the background image that the mouse pointer clicks over.
I am getting a Javascript error from Firefox 1.0.5 when I try to reference a table within a window that has just been opened and written to. I get the Javascript error "cartTable has no properties" where cartTable is the variable I assigned the table reference to.
Previous to this, I have just opened a new window, used the document.write method to write some HTML into it, and then used the document.close method. At that point I call a new function to add some extra things into the new window and this is the first statement that gets run. It seems as if the table isn't quite finished loading when I try to reference it and that is causing problems. I am not getting any errors in IE6 and it is working just fine. I figured that maybe I could implement a loop to just wait until the table is fully loaded but that will just loop infinitely for some odd reason.
while (!winDVDCart.document.getElementById("cartTable")) {}
This code just loops infinitely, but if I just put an alert within the {} for the while loop, it shows the alert once, I click ok and everything works great after that. Could anyone point me in the right direction on this?
AwebappI am working onmust use millimeters instead of pixels for the top, left, width, height and font-size style attributes. There happens something strange when setting these style attributes with mm values.
It would appear that it is not possible to retrieve CSS properties such as min-width if they have been set from a class. However, I don't want to have to style everything directly with the style attribute whenever I need these properties. Is there a reliable method of getting these properties as applied to element from a CSS class?
i want to set page properties within the page itself. i can easily open a new window, but i don't want to have to do that. width, height, toolbar, scroolbar, navigation, etc... it seems like i've done this before, but for some reason i'm drawing a blank. any suggestions out there?
I'm trying to iterate thru form elements and pull out the ones with "note" in their name. getting "elementName has no properties" with the following code, and i don't understand why?[code]...
I have been working on an Ajax class, but have encountered a problem in IE which i cant seem to work around. In IE i get the following error, referring to the requestChange method.
"this.objParent.objRequest" is null or not an object
As the requestChange method is called as the onreadystatechange function, ive had to assign a variable referencing the parent Ajax object to the requestChange method, which is done in the Ajax construct method. This allows me to reference the Ajax Request Object from the requestChange function.... in firefox at least. Code:
I have a quere.How to get the url from the properties window in internet explorer using the java script.Ex: I opened browser and navigated to[url]....Now I right clicked on the page selected properties option.In the properties window i need to get the url using java script.
I am drawing lines inside of a <div> (wrapper) using <div> id's by incrementing the height and width properties using javascript functions. I use setTimeout to gauge the speed and clearTimeout for when the current line is finished being drawn. Then we call the next function to draw the next line ... etc.... etc.
At first I was going to go the whole "createElement" route. Then I thought "Why not go ahead and define all the lines and id's in the body of the page and just set the initial heights/widths to "0" (hence they will not be seen until we start to increment).
XHTML Transitional looks like this:
What do I have to do be able to set multiple style properties?
I am getting an invalid argument:
I have been through this once before. This time I am not leaving anything out in hopes that someone could elaborate on why does:
But:
To me, it looks like the same approach is being used.
I have a number of show/hide images on my site which allows the user to click on various thumbnails to open up the full image using layer based styles.
However, my Javascript seems to have developed an error saying that the object has no properties and then takes me to the following line of code:
obj.visibility='hidden';
This code was written for me so that i could use the script dynamically with PHP an alter the number of div layers it needed to generate.
The full(?) javascript for this function is:
function showImg(myShow) { var loopNum=99; for (x=1; x<=(loopNum); x++) //1 based loop
I would like to generate a page of links including some of the pdf properties (title, author, version, etc.) for a folder full of pdf's. Is this possible from Javascript?
I try to associate DOM nodes with other objects. Assigning custom properties to DOM nodes works in Firefox and Safari. It also works with HTML nodes in IE6. However, it appears not to work with XML nodes that are part of trees returned by XMLHttpRequest. How can I work around this limitation? For XML nodes, I need to be able to associate at most one object with each node.
The syntax I am using is node.customproperty = value
I would like to have the properties of a linked file appear on the page linking to it, so that the user can see the date last modified and file size. I.E.
<a href="filename>Click here to download file: size <script to insert file size>, last modified on <script to insert date last modified></a>
Is this possible using only javascript. I don't have access to PHP/ASP/anything else useful on the server. Perhaps you might know of an alternate way to achieve my aims?