I just wrote this script which loops through all of the CSS properties for an element, and dynamically generates an HTML document using a for/in loop in a new window which is a table of all CSS properties and values for the element. Some may find it useful.
I'm sending arrays of results from my server in response to an xmlhttprequest like so:
array({key:value[,...]}[,...]);
I know I could use an associative or indexed array, but this is just how I wrote it as I'm using the prototype library and I'm in the habit. Anyway, I want to know if I can reference 'key'. If so, umm, how?
I'm using javascript to dynamically make controls show up or disappear on a form. For some reason, if I load a control (in this case a select control) into the Div it shows up perfectly. If I load text in there, it is fine too. However, if I programmatically try to go from the select control content and cover it with text afterwards, that won't work.
If I change the content from one string to another, it works as well. I just cannot remove a control I've put down and replace it with text or "" or whatever.
({}["toString"]) - function alert("toString" in {}) - true
But I want to only find a property that is defined in the object - not in a prototype.
for(var prop in {}) { alert(prop); }; // toString not found.
It seems that operator 'in' is overloaded. 'in' during iteration: look in the property. 'in' in a boolean conditional: look in the object, then up the prototype chain.
I want a way to get only properties defined within the object itself, not it's prototype. Is there no simple way?
i am developing an application , we have to run it for Netscape V4.76(!!) , the problem is it seems that Netscape V4.76 does not support 'disabled' for form elements for example something like
I would like to override the "disabled" property of a hidden field. When disabled is set to "true", it would call a function to disable 2 other text fields on the form. When disabled is set to "false", it would enable those 2 text fields. You should also be able to get the value of it as if it were a property:
I have a script that I want to run only when my input box IS NOT disabled. Can someone tell me if something is wrong with my script? Is "disabled" the correct property to use?
function TextChanged(i){ if (!document.ScheduleForm["txtGrossPayroll" + i].disabled) { document.ScheduleForm.txtRecordStatus.value = "Changes Made; Record Not Saved.";
var x =window.open('http://localhost/canvas.html','myokno') var w =x.width Permission denied to get property Window.width var w =x.innerWidth
Permission denied to get property Window.innerWidth why i can get properties of new created window??? The second problem is much more important: i want to get element which id is "canvas" and it is in new window so i do like this:
var canvas = myokno.document.getElementById('canvas') ReferenceError: myokno is not defined var canvas = x.document.getElementById('canvas') Permission denied to call method HTMLDocument.getElementById
so i start working on the problem and: var can = x.document can [object HTMLDocument] var can2 = can.getElementById('canvas') Permission denied to call method HTMLDocument.getElementById
I am writing a Javascript UI component. I have already written a "disable()" method for it, but I would like to go one step further in order to make my component as compatible with existing HTML controls as possible.
With standard HTML controls we can do this: myTextField.disabled = true; and as soon as this property is set, I assume there is a property listener of some kind that is invoked to change the appearance and value etc of the control.
I want to write my own 'property listener' to do this with my control. Can I do it in Javascript or is this too "low level", requiring code at the browser implementation level?
To stop the keyboard event for the F4-key from propagating in IE I need to set event.keyCode to 0. But setting keyCode to 0 in Mozilla/Firefox will throw an exception since it is a read-only property.
So, how do I check if event.keyCode is writable?
(I could do some check to see if the script is run in IE or add a try/catch for Mozilla, but I would like to know the 'correct' method)
Is there a way to make one property an alias for another? This would mean that if the value of the original is changed then so is the value of the alias. I tried the following example and it does not give this type of behavior, of course. Code:
Is there a way to access the value assigned to onmousedown for an object? I've been searching online but can only seem to find how it is assigned via html. What I need to do is access the value (the script string) in javascript.
For example, I'd like to try to do something like this:
function virtualClick(objectName) { eval(document.getElementById(objectName).onmousedo wn); }
I am of course not explaining the full problem in detail, but would appreciate any input on how to access the onmousedown value (or to know if it even exists as a property).
Can someone please explain why the following code works in IE but not firefox please. In ie I get an alert box with "mynewprop" but in Firefox I get "undefined"....
I have developed a script that change the font size in css, but only the attribute "font-size" on the body tag, not change the entire active stylesheet.
When i click to change the size <a href="#" title="Change Font Size" onclick="cambia_font_size(2);">A</a>
It works fine, but when i try to check the cookie to set the default font size, it does not work.
The cookie stores the value correctly and i can read the value. The problem is when i try to change the value: document.getElementsByTagName("body")[0].style.fontSize=tam;
I have tried also writing this code at the end of the html document but it doesnt work <script type="text/javascript">inicializa_fontsize();</script>
With something like this : <form name="a"><input name="name"></form> Is it possible to get the name of the form (a) and access the input object (name) too?
I'm trying to figure out how to use a variable as a css property. For example: $('.name').animate({variable : 100}); I wrote up a quick example script. My goal is to switch the animation direction depending on the link that you click. Either have the object animate from the left or top. Any ideas how this could be done? Or why this isn't working as
I'm using ccs3PIE with my site. What I want to do is check if a DOM element has a css property like border-radius and then add a class to it.
The problem I'm having is that I don't know how to check for the css property. I've been searching for it for a couple of hours now and I can't find anything that seems to work.
I have a JS script that presents a series of "pages" with different questions inside a single HTML file, by rewriting certain <div>s. I have an object like this that contains the questions and information about answer labels etc (the idea is that this should be easy to modify for someone who doesn't know JS):
I've got this JavaScript code that is doing stuff to the content of <TR> rows.. but it's overselecting and I need to filter the <TR>s it selects in the bold line.
var theRows = document.getElementsByTagName("TR"); var r = 0; var strTitle = "";
I have a page: [URL] that works perfectly fine in every browser I try, except for actual IE7 (it even works fine in IE8 emulating IE7). When you search for something on that page and have a display of results, each result has a link that changes a table row's display to visible, and hides the row when clicked again. It doesn't do that in IE7. here are no errors or warning in Firefox's Error Console. But IE7 has an "Error on Page" notice (which does NOT appear in IE8 emulating IE7), that says:
Line: 59 Char: 11 Error: Could not get the display property. Invalid argument.
[Code]I really don't know what to do, or where to begin. Everything in my limited knowledge seems to be working just fine. Most of my site's visitors use IE8, but enough use actual IE7 that I really need to fix this.
I have this simple manual photo slide show. It shows four photos and when you click the next button and it moves one photo over and one photo back for the previous button. I have to moving by changing the CSS property of 'left' by 195 pixels each move. So for it to move next it will subtract 195 pixels from the left property and for moving back it add 195 pixels to the left property. I have the code setup so when you click it changes the property of left to either -195 or 195 pixels but I need it so it actually does the math, not just give it a set value. But I don't know how to do that.code...
The code works as expected in Chrome, but not in IE and FF. In IE the error is "Object doesn't support this action" and in FF "setting a property that has only a getter". In Chrome there is no error in the console. There are three javascript <script>...</script>s that exist to display a <td> row in a table with a particular graphic depending on the screen width. The odd thing is that in both IE and FF (and of course Chrome), the first two scripts display perfectly well. Why does the third <script> produce an error? It has exactly the same form as the two before it.
I can only guess it has something to do with where it occurs :confused: Googling the FF error, it has something to do with trying to set a read-only property, but then why do the first two <scripts> work? They are no different (at least I can't see a difference.)