javascript

Does jQuery have something similiar to YUI's getDocumentScrollTop?

Does jQuery have something similiar to YUI's getDocumentScrollTop? (reference: http://developer.yahoo.com/yui/docs/YAHOO.util.Dom.html) ...

Passing $(this) to jQuery fadeOut callback

I know I need to use a callback so that html() doesn't happen until after fadeOut(), but inside the fadeOut() callback I don't have access to $(this) from .hover. I tried passing the selection using var point, but it's not working. if(!$.browser.msie) { points = $("div.point"); } else { points = $("div.flash"); } Problem Area: $(p...

Passing strange text as variables via post method in php

I have an odd problem. Our company collects data and we use a HORRIBLE piece of software to handle all of our phone interviewing. It uses binary files instead of SQL and uses no compression. As of right now we have to manually run all reports for the clients. I am working on building a web interface to our data and common reports. Now I...

Truncate words function in javascript (studying dojo's code)

A 'truncate words' would take a string of words and return only the first, let's say, 10 words. In dojo (javascript library) they have such a function, whose code is this: truncatewords: function(value, arg){ // summary: Truncates a string after a certain number of words // arg: Integer // Number of words to tru...

How can I call a JavaScript function defined in a PartialView after an AJAX request completes?

Here is my partial view: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <script type="text/javascript"> function myFunction() { .... } </script> ....other html content ... On my page, I have a link that calls a controller action to render the partial view: <%= Ajax.ActionLink(..., new AjaxOptions { ..., On...

Question about using special variables in functions for jquery UI/Draggables

I always see this in the documentation. $('.selector').draggable({ start: function(event, ui) { ... } }); In the jQuery documentation, what does "event" and "ui" represent and how can I use them? Is there any way to pass the specific .selector object itself into the function? I guess I don't quite understand how this whole thin...

Javascript / jQuery image zoom plugin

I need to display an image in a fixed size div. Under the div must be some control, like a cursor bar, which sets the resolution of the displayed image. I don't mind much writing the thing, but I thought it might already exist. How come I can't find such a thing ? (I am not interested in things like jQZoom nor zoomimage which do not le...

I have working Javascript code that that converts any number entered into its text equivalent

For example, 4 is converted to "Four" and 33333 is converted to "Thirty three thousands three hundred and thirty three". I am thinking of using JQUERY instead of plain JAVASCRIPT. Here is the code in its entirety: <script language="javascript" type="text/javascript"> function NumberToTextConverter() { this.TEN = 10; ...

YUICompressor or similar in PHP?

I've been using yuicompressor.jar on my test server for on-the-fly minimisation of changed JavaScript files. Now that I have deployed the website to the public server, I noticed that the server's policies forbid the use of exec() or its equivalents, so no more java execution for me. Is there a decent on-the-fly JS compressor implemented...

Get Selected Node Id

Hello, I'm developing a Firefox extension, where the user selects a text, then that text goes to a REST webservice and brings some results back. My problem with text selection, I've used this method to get the selected text: var selectedText = window.getSelection(); I got the result in selectedText variable and send it to the server...

What's a good way to refactor a growing number of javascript/jquery functions?

I'm working on a project where we are doing a lot of custom javascript and especially jquery, on an mvc style project. The only problem is that I keep adding more and more global functions/variables and they are piling up. I've got a few files but I'm unsure how to split some of the stuff up into separate files. I've thought about co...

JScript Enumerator and list of properties

Consider the following WSH snippet: var query = GetObject("winmgmts:").ExecQuery("SELECT Name FROM Win32_Printer", "WQL", 0); var e = new Enumerator(query); for ( ; !e.atEnd(); e.moveNext ()) { var p = e.item(); WScript.Echo(p.Name + " (" + p.Status + ")"); } It prints in every line a printer name and the word "undefined" in...

document.getElementById().value and document.getElementById().checked not working for IE

I tried to assign a new value into the hidden input and check box, it's worrking fine in firefox but not in IE (im using IE 7). Does any one know waht is going wrong with my code? Please see below for more informationL: HTML: <input type="hidden" id="msg" name="msg" value="" style="display:none"/> <input type="checkbox" name="sp" value...

If id == 1, the following jQuery code will not work

I have a DIV Called fArea and when i click the open button it's sets fo=2 but the code still refreshs so i tryed to add if and else and now it is not displying anything. jQuery Code: function unique_requestid() { var timestamp = Number(new Date()).toString(); var random = Math.random() * (Math.random() * 100000 * Math.random() ...

In YUI, is there a way to reference the tab or tabview objects from the DOM?

It seems like there should be, but I've looked over the API and nada. I don't see how it's done in 2.x. Currently, I store references with the elements to the tab and tabview objects via jQuery's data method. The why: When I interact with the tabs via mouseovers and clicks, I need to be able to reference the YUI tab/tabview objects' pr...

XmlHttpRequest vs cURL

I was wondering if anyone has done any testing on the speed differences of cURL and XHR (in regards to the time it takes to complete a request, or series of requests). Specifically I'm wondering because I would like to use XHR to go to php script, and use cURL from there to grab a resource. The php page will ensure ensuring the data is ...

misspelling javascript function alert to alerler('hell'); and firebug doesn't report an error?

misspelling javascript function alert to alerler('hell'); and firebug doesn't report an error. Why is that? It is enabled for localhost (or my site). ...

replace symbol in javascript

Does anyone know how can I replace this 2 symbol below from the string into code? ' left single quotation mark into ‘ ' right single quotation mark into ’ " left double quotation mark into “ " right double quotation mark into ” ...

Nice, clean, simple way of getting a dataset from ASP.NET to plain HTML jQuery or JavaScript library?

I know this is a probable open ended question, and I have tried looking around so much over the last year or two... maybe I am looking for a perfect place that doesn't exist! of course it's all about perception no less.. Anyway, just to clarify what I am trying to do and why: I want to be able to use (primarily for the moment) ASP.NE...

Cannot pickup id with JQuery for the JSF textarea

Hello everybody I have a little problem I am trying to use MartkItUp JQuery rich text editor on JSF textarea component. MY form looks pretty much like this: <h:form id="comment"> <h:inputTextarea id="commentBody" cols="10" rows="10" value="#{postComment.commentBody}" required="true" requiredMessage="Comment Body i...