javascript

What does MooTools' Function.prototype.overloadSetter() do?

I'm looking through the MooTools source to try and understand its .implement() and .extend() utilities. The definition of each refers to a function defined like this: var enumerables = true; for (var i in {toString: 1}) enumerables = null; if (enumerables) enumerables = ['hasOwnProperty', 'valueOf', 'isPrototypeOf', 'propertyIsEnumerab...

Using HTML5 file uploads with AJAX and jQuery

Admittedly, there are similar questions lying around on SO. But it seems none quite meet my requirements. Here is what I'm looking to do: Upload an entire form of data, one piece of which is a single file Work with Codeigniter's file upload library Up until here, all is well. The data gets in my database as I need it. Good good. But ...

Opinions on possible optimization for a web application using javascript

I'm thinking of implementing my web application in a certain way as an optimization, and I'd like to get people's opinions on whether this is a good idea or not. Here's the details: For most of my pages, instead of determining server side whether the user is logged in, and then modifying the page I send based on that, I want to send the...

How do you change the value of an HTML element with javascript?

I have this: <input type="button" value="hello"> I want to change the value with javascript so that it is value="goodbye". How do I do this? Following @David's advice in the comments below here is the code I tried but could not get to work before posting this question: var createBttn = document.getElementById('create'); createBttn.inn...

Explode a string into a hashmap for searching?

I have a string like this being returned from my backend: "1,2,3,4,5,6" I have a large array locally and want to display only those items not in this list, so I was thinking of exploding this string into an array but how can I search efficiently? As far as I know there are no hashmaps in JS so how does one do this? I just need to chec...

Internet Explorer Background Repeat on container for floating elements

I am attempting to build a gallery page for a website I am working on, Internet Explorer 8 compatibility is a must. After building the script out for the page, I take a look in internet explorer and run into this interesting issue. It seems that my background image is running fine until suddenly it just stops. I have no idea why this is ...

Build URL from Form Fields with Javascript or jquery

Hello, I have a quick question, I can't seem to find a suitable solution to anywhere else. I'm trying to create a URL builder form with Javascript or jquery. Bascially, it will take the value of the two form fields, add them to a preset url and show it on a third field on submit. The resulting URL might be http://www.mydomain.com/in...

NXE dashboard in HTML 5

Im looking for a NXE dashboard style template in HTML or CSS or javascript just not flash. For those of you who dont know what NXE is, its the xbox dashboard. any information on this please respond ASAP. thanks ...

Javascript Escape Characters

I have kind of a lazy form that has two textboxes. When I click a button I basically concatenate the two textboxes with a delimiter. Is there like a special delimiter that cannot actually be typed in an html textbox, even if the &#xxx; syntax is used? ...

How do you avoid the drop-down ActiveX warning in IE7 and IE8?

I am currently using javascript to enable changes to css on hover for certain items in my html page. In Firefox I never get an ActiveX message but in IE8 I get a message stating "To help protect your security, Internet Explorer has restricted this webpage from running scripts or ActiveX controls that could access your computer. Click he...

Easy to understand and follow books on jQuery and javascript?

I would like to know your opinion of a good jQuery and JavaScript book. There are just too many of them [when I try to search]. Please suggest some really good books which I could buy. My current knowledge on these technologies - Close to Zero. Thanks in advance, Rahul ...

How do i trim in javascript or jQuery?

how do i trim using this $('#type_of_station').text() the result is >>> $('#type_of_station').text() "pizza delivery system " As you can see there is a space after the last word ...

Can I capture and save the current state of a webpage using javascript

I need to get the entire contents of a page with javascript and send it to a server script to save it. I want to do this after the user has made some changes to the page using AJAX and other javascript tools. I don't want the state of certain elements. I'd like to essentially get everything inside the body tag so I can pass it to a serve...

execCommand justifycenter

If I try to execCommand("justifycenter"... a paragraph on my page in Firefox, it doesn't work; it's giving me this crazy error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLDocument.execCommand]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: editor.p...

pagination using javascript for API

I have an API which contains a JSON . The JSON looks like as shown below {"oldestId":"1","latestId":"42","records":[{"id":"42","uid":"34","time":"1134314","email":"[email protected]","fName":"Matt","lName":"Wright","level":"0","description":"User [email protected] logged in"},{"id":"41","uid":"34","time":"1134314","email":"[email protected]","fNa...

Does Javascript SetTimeOut Affect Page Performance?

I am writing an AJAX script that basically calls a PHP page and requests some information. The PHP page queries a database. I want to set the page to make the call every 5 minutes, but the only way I know how to do so is by using the settimeout function. I am wondering if this settimeout function is constantly running is this going to be...

how to implement the comment popup window at dealsea.com?

I came across [check revision history for link] and surprised by its clean design. I am particularly interested in how the site implement the "Add Comment" popup when you click any of the "Add Comments" link under a deal. My JS knowledge for popup is still at the .. level. Yet this site is using < a class="addcomment">Add Comments only....

How to add a "preview" stripe to my site

I would like to add a "preview" stripe to a site. I like what blogger does when you click to preview editing a post (Anteprima means preview in italian) Do you know how to make it as a layer in order to plug it without modifying the main html code of my site? ...

How to hide a group of td elements?

I am making a dynamic form using table. My table was like below. <table border="1"> <tr> <td>A Label Name</td> <td>:</td> <td colspan="4"><!-- Input text --></td> </tr> <tr> <td>Category</td> <td>:</td> <td colspan="4"><!-- Select Option value: { both, group 1, group 2 } --></t...

options_from_collection_for_select that avoid refresh problem

Hi, I recogn that I can use an options_from_collection_for_select inside a select box to display a list of options inside it. If I add (first.id), it will select the first option as default preselection. Example : options_from_collection_for_select(@hauses, 'id', 'timebuild', @hauses.first.id) However, if in the index.rhtml, I put th...