javascript

Http request for js and css file

Hi, In my website, when I analysed it. Shows that my site has a 17 external js file and 4 css file. And recommended me to reduce the number of http request made. And my questions are... 1) Does more http requests reduce overall ranking? 2) If I reduce my http requests by combining js file, the js and css file will be lar...

Using a javascript object like a java Map?

Hi, I need something of a HashMap in javascript. Can we do this: var map = {}; map['foo'] = true; map['zoo'] = true; ... if (map['foo']) { // yes, foo exists. } else { // no, foo does not exist. } how do we properly check for the existence of the property without inserting it if it does not exist? For example, I don't want m...

add setters getters recursively

I realise that this is something that should probably not be so awkward but I'm still having trouble with the setters/getters.. It isn't so much the getters/setters programmatically, more getting the recursion multiple levels deep correct. Long story short I want to define a bunch of default settings, then add getters/setters that retri...

Fading through background images with JavaScript/Jquery

Hello, I dont know alot about Javascript. I want about 5 background images to continuously rotate and fade with a 5 second interval. There are a lot of image slideshows available on the web, but I need it to be with a background image on my site. Any help is much appreciated! ...

How does Google Scribe work?

I'm asking about the new labs feature "Google Scribe." Here is the link: http://scribe.googlelabs.com/ I am interested in the backend and the frontend, but mainly the backend. I want to build something similar with a very specific data set (derived from my own documents). I think the frontend of it is fairly straightforward, and I co...

How to manipulate form data before sending to server?

Hi, I want to collect 25 schedule times (hour and minutes). User will input 25 times using drop down boxes. That means, 25 hour and 25 minutes drop down boxes, making total 50 drop down boxes. But I don't need to send them as individual variables. One string like- 08:05;08:37;09:43;09:59:11:12;12:34 will do. So, the variable to send wil...

Which web technology[ies] should I learn?

Hey guys, I have never done any web development but am very interested in learning some web technologies. I believe I have a fairly solid understanding about programming, so I think picking up different languages/technologies shouldn't be too difficult. I am a junior in college, majoring in CS, and would like to work on a couple of smal...

Can I rewrite a URL without redirecting?

So I learned from this handy guide how to use .htaccess to redirect pretty URIs like foobar.com/baz to specific content that may reside at foobar.com/bazheader345.php?user=baz. What if I'd like to do the opposite? My anchors are static but I have a lot of content in different files - and none of them has a particularly pretty name. Say...

Why don't my Greasemonkey scripts work in Chrome?

My Greasemonkey scripts all work in Firefox 3.6, but in Chrome 6 nothing special happens when I load a page that is supposed to trigger them. Here's an example script (pasted below) that highlights top comments on Hacker News. Can anyone identify what I'm doing wrong? When I click on the user.js file and install it in Chrome, the install...

Adding a dynamic function to an object.

I'm trying to get this to work, but it doesn't: var i; i.test = function() { alert("hello"); } i.test(); I expect the code to alert 'hello', but instead, the Firefox error console shows: missing } in XML expression alert("hello"); ---------------^ How do I fix this... ...

Create a file in memory for user to download, not through server

Is there any way I can create a text file on the client side and prompt the user to download it, without any interaction with the server? I know I can't write directly to their machine (security and all), but can I create and prompt them to save it? ...

Best way to create javascript classes with object literals and defaults

What is the best way to go about creating javascript classes so that objects can be created by passing in object literals, and at the same time maintaining defaults set in the class. var brett = new Person({ name: 'Brett' ,age: 21 //gender: 'male' //The default is female, so brett.gender will be female }); ...

Vertical Alignment of inner elements

I've two elements in <td> a <div> and some text. I would like to align <div> to top and text to middle of <td> How can I do that? Edit: The should be vertically top aligned and not text inside div. ...

hide heading if no div below

I have some layers like so <div class="evenprop">some prop</div> <div class="evenprop">some prop2</div> <div class="evenprop">some prop3</div> <h3 class="otherprop">Other Props</h3> <div class="evenprop">some prop4</div> <div class="evenprop">some prop5</div> This is fine but I need to hide the "otherprop" class if the data looks li...

document.readystate of "interactive" vs. ondomcontentloaded?

Could anyone tell me the difference between the "interactive" state of document.readyState and "DOMContentLoaded"? I couldn't find a lot of info on the "interactive" state and what specifically is available to be used in the page. This page says: interactive - Has loaded enough and the user can interact with it Which seems a hel...

setAttribute("value") not working on password field

Sometimes passwordField.setAttribute("value","newValue") doesn't work on my password field. But passwordField.value = "newValue" always works. moreover, setAttribute is working fine on Mac platform but sometimes doesn't work on win platform Why is this happening ? ...

How to create a flexigrid with passed variable from another controller in code igniter?

Hi everyone. My problem is kinda silly but I don't know how to do it. I'm creating a standard flexigrid using standard structure: //ver lib /* * 0 - display name * 1 - width * 2 - sortable * 3 - align * 4 - searchable (2 -> yes and default, 1 -> yes, 0 -> no.) */ $colModel['users.id'] = array('id',...

2 same (function,class) name "Ajax" in prototype

In the project I am working on uses established and then used in many parts function Ajax (recvType, waitId) I want to use the "prototype framework" it have class Ajax it is better to do and where to change ? or change in prototype and afte using another name instead Ajax some else name? Or change in all project ? or is there a way ...

How can i load a javascript file using a bookmarklet that in turn does not redirect/rewrite the page?

I'm trying to load this remote debugging solution to debug/interact with DOM/js live. The instructions ask you to put a script block and script link into the HEAD of the page to get it all working. That's fine. It's a great tool. But what if i wanted a bookmarklet-like way of just "inserting" it into any page. I don't see why this can't...

Ext JS Tree with Grid in nodes - combine widgets

I'm looking for a solution on how to combine two widgets. I'm taling about the Tree widget and the Grid widget in such way that f.e. every node of tree represents a database table and after expanding it shows record in a grid widget. Is there a way to combine those two in one ? ...