Position Reporting Function: Flanagan, Yahoo!, Kruze, Prototype ... All Broken At Least A Little.
Oct 9, 2006
It seems like determining element position in a web page is a difficult
task. In the position reporting source code I've looked at there are
special fixes for at least some versions of Safari and Opera. I am
doing a lot of dragdrop experimentation and in some situations need a
position reporting function. The function doesn't need to report the
positions of exotic elements like images in button elements; however, I
would like a position reporting function that can at least handle
combinations of scrollable elements and tables....
According to ECMAScript, the root of the prototype chain is Object.Prototype. Each object has an internal property [[Prototype]] that could be another object or NULL.... However, it also says that every function has the Function prototype object: Function.Prototype, it confused me, because a function is an object, for a function object, what is its function prototype and object prototype..For example:
var x = function (n) {return n+1;};
what is the relationships of x, Object.Prototype and Function.Prototype
I am trying to get to the bottom of javascript object, prototypes etc. I have a fairly good grasp of it, but I get confused the closer I get to the base object.prototype. FIrst of all, I was under the impression that all objects descend directly from Object. But some objects (like Array) seem to inherit properties and methods from the function.prototype. So does this mean that the chain is like this:
object -- function -- array Second, I noticed (on the mozilla javascript reference site that object.prototype inherits properties and methods from function.prototype and vice versa!? How can this be? I must be missing something important about understanding the chain?
A common javascript function that capitalizes input as user types (onkeypress) no longer works as of IE9Need a function that also works in IE 9 that doesn't not change method call or interface (as it's used in 150 places throughout application).
CALL: [CODE] el.onkeypress = function(el) { return c_capitalizeInput(el); } [CODE] FUNCTION: [CODE] // Intercepts keyboard input and capitalizes keystrokes. // Call with onkeypress="return capitalizeInput(event);" // Compatible with both IE and Netscape/Mozilla function c_capitalizeInput(evt) { evt = (evt) ? evt : ((window.event) ? window.event : ""); if (window.event) { // IE if ((evt.keyCode >= 97) && (evt.keyCode <= 122)) { evt.keyCode = evt.keyCode - 32; } return true; } else if (evt.which) { // Netscape and Mozilla key = evt.which; if ((key >= 97) && (key <= 122)) { key = key - 32; evt.target.value = evt.target.value + String.fromCharCode(key); return false; } return true; } else { return true; // Can't do anything for other browsers } } [CODE] How to make this work in IE9?
Let's say you have a little Ajax script and it sends data to the server to do something. Now the server has an issue of some kind (let's say with the query) and can't so what you expect it to do. What's the best way to tell your awaiting Ajax functionality something went wrong?
I am trying to use the sortBy function in the prototype.js library. Nevertheless, I can't work out what to include in the iterator function. Can someone shed some light on this?
Array.prototype.each = function (fn) { this.map(fn) }
This is my each function that works great in every other browser but IE. UGH! What am I doing wrong? the error points to the this in the function. Is it that IE doesn't like map? Has anyone seen this before? I thought my code was correct. Works perfect in FF, chrome and opera. the canvas text doesn't work in opera, but it does render the features so the each function is working.
I'll post the code if needed, but it's huge. here's the script running.[URL]..
I am not quite sure where to place this question since it involves C#, javascript and even a call to SSRS. What I want to do is call a Sql Server Reporting Services Report, using javascript like so:
The code works and I can pull the correct report. The issue is I wanted some visual que for the user that the report was being generated. that is why i used the javascript functions : cursor_wait(), and cursor_clear(). The problem is I want to display a wait cursor until the window with the report returns and displays the report then reset to the default cursor at that time. But the above code resets the cursor right away without waiting for the report to return. I tried adding attributes to the page form and other methods to access onBlur and such but haven't been able to get there yet.
I have a periodicalUpdater that returns countdown time that is created with php but I now need to call out one function when the time is right. the script PeriodicalUpdater calls
I'm learning how to use Javascripts and using Prototype framework by following a step by step tutorial from a book. Unfortunately when I stepping through the following code:[code]
Not sure if this is possible, but I have an external script that creates an object, and I want to overwrite some of its functionality, but keep the scope.
Here is a basic example:
Code: <script> Obj = function (userConfig) { this._init(userConfig);
[Code]....
I want it to log two Objects, but instead I get two window elements. Is this because I am declaring the functions in the global scope, and not from within the object?
Anyway I can keep the scope of the object, whilst still overwriting the function?
This JS code is on RoR+ImgMap site.I've tweak several portion of ImgMap, specifically around line 2205 of the file imgmap.js by adding code.so that when the user draws a shape, the focus will be set to the respective href field, instead of the default behavior - adding new row(imgmap form).
I need to know how to add an event to a button. The specific issue is that I want to add an event which is a prototype function of a class. Consider the following as an example:
I want to write a plugin, say 'myPlugin' which I can use like Code: $('#myID').myPlugin() ; $('#myID').myPlugin.test() ;
The plugin I wrote looks like Code: (function($){ $.fn.myPlugin = function() { // do something } $.fn.myPlugin.test = function() { var $this = $(this) ; // do something ; }})(jQuery) ;
This works and it doesn't work. It works because test() is called, but this is not the element with id '#myID' it is $.fn.myPlugin. To fix this I tried the following Code: (function($){ $.fn.myPlugin = function() { // do something } $.fn.myPlugin.prototype.test = function() { var $this = $(this) ; // do something ; }})(jQuery) ; but now the function 'test' is unknown.
is there a way in jQuery to bind variables to function calls similar as prototype.js does it? See [URL]
E.g. in the slideUp method of jQuery you can specify a callback that is called after the effect has finished. I would like to bind a variable to this call so that it is used inside of this callback as a closure.
i,m trying to make a map who show me as position A and a target adress as point B.I have made it so i can choose adress a and adress b from a dropdown but i want to automaticly load my position as possition A then choose position B from a dropdownlist. How can i do this ?
I am trying to develop a dashboard for reporting on a large dataset of customers. When it reports on filtered results it works ok but whenever we filter on something that returns a lot of results (ie. customer without email addresses, or a specific customer type ajax returns blank. I have tested the query and apart from taking a while to return, there is nothing wrong with the query.
[Code]...
This just builds the query dynamically based on the results of the above, ignoring any value that equals "NOFILTER".
I'm having trouble loading jQuery into SQL Server Reporting Services Report Manager. Since SSRS is a proe-compiles ASPX page, and we are not given the source code, we have little ability to make changes to the interface. If I could add jQuery directly, the progblem would be trivial. However, all we have the ability to modify is an existing Javascript file that is loaded at runtime in the head of each page. I have been able to get this to load relatively reliably using IE 8, but other browsers either don't load it at all, or only on the first pass. Here is the structure that I have in place:
Is there any such thing as a jQuery Debugger, i'm trying to learn jQuery but even small things like Syntax errors keep getting in the way and it's hard to track down without any error reporting.
In Yahoo mail, I click the Inbox link and see my messages. If I view source, I don't have HTML which contains the URL of each message. The source HTML contains javascripting and framesets. This is different from what I am seeing.
If I right click on a message link and select "copy shortcut", I can paste this link into my browser. This brings me to my message. If I view source, once again, it is javascript and framesets. How do I get at the HTML that is making all the tables and contains the images I'm seeing?
Accessing IE DOM is a possibility but won't that just give me access to the javascripting and framsets since that is all the client has (remember what is seen in view souce)? I know the HTML has to be accessible somehow. Otherise, you wouldn't see it...right?
There is a long thread about this in the posiiton() reference page, but I am not finding a thread here in the forums, let alone a solution. I have some code that is trying to do calculations on the left and top attribute of child DOM elements. So, I have 5 divs (floated left, with width and height assigned), contained in another div. If I iterate over the 5 divs and call either position(), offset() or even css('left'), they always return 0. I have tried setting margin: 0px as well, but same result.
I'm looking for a function that I can use which will do the following when the mouse cursor is in a textarea:
know which textarea to work with based on current cursor position (not sure if this possible, couldn't find examples) - i.e. just 1 'Bold' button to operate on multiple textareas.
insert tag or tags (i.e. ,[image]) at cursor position, if text is selected then insert tags around text selection.