javascript

jquery - how do i access those arrays and variables in the dom?

Hi, Im using firebug to debug jquery and in the dom tab i can see all the vars and arrays in there. How do I access the different arrays and vars in the dom? Cheers Ke I cannot access these object items, even though firefox lists them, i have sitems in the top level of the dom, i also have sitems within the parent variable. a lot of...

Will combining javascript files help speed up the website in IE8?

Hi All, PageSpeed and Yslow suggest that to combine javascripts file to reduce HTTPRequest. But this is becuase (I think) pre ie8 browser has no more than 2 serverhost connection. But nowaday, browser has 6 serverhost connections, which means it has download javascripts in parrallel. So let say we have 1MB of javascript, should we brea...

How to load a file list in javascript?

How do I load a list of files from a specified folder in javascript? update Actually is from a Xul application, but I think anything for a local html file will work.. (it's a standalone app). And are resource files (images) I'm talking about.. ...

Javascript Event Key Property Mixup in FF

This is a weird bug, indeed. In Chrome (6.0.472.62, latest) and IE8 (at least), this behaves correctly, but in FF (3.6.9, latest) both the click event and enter event register, making it hard to discern between the behavior. Check out this code: http://jsfiddle.net/QmkwY/1/, click on the search box in the "results" and just hit enter. T...

Cross-browser, javascript getAttribute() method?

trying to determine a decent, cross browser method for obtaining attributes with javascript? assume javascript library use (jQuery/Mootools/etc.) is not an option. I've tried the following, but I frequently get "attributes" is null or not an object error when IE tries to use the "else" method. Can anyone assist? <script type="text/java...

Writing a single page client-side only webpage

I'm considering to try out an idea, mostly for fun, and my question is if this is reasonable and if there are any libraries or frameworks that could make this experiment a little easier. So, the idea: Basically it is to write a new UI for a website I've developed, but doing it with client-side code only. I can read/write data using ajax...

Rails — send chat message by Enter (ajax)

Here is the chat submit form: #chat_form - remote_form_for :chat, :url=>{:controller => "chats", :action=> "new", :id=>@request.id }, :html => { :autocomplete => 'off' } do |f| = f.text_area "message_content", :rows=>5, :cols=>55, :autocomplete => "off" = f.submit(value = "Sayit!", :class => "submit small") chat#new....

.js file format

I was wondering if there is a good reference to how best to format .js files? Do you treat them like you would class files or do you separate out the functionality based off the page it handles? Do you create .js functions that could be used across several pages or do you write a custom .js file for each page? I'm just curious if th...

Looking to build an expand on hover/contract on blur div

Hey all, I've been beating my head against the search engine walls for a couple hours now and figure I might as well just ask... I need to build a div that is one size on blur, say 300x30, that expands to 300x300 on hover and pushes all content below it down and will revert to the 300x30 size when blurred ("no longer hovered" or whateve...

Tab-completion for V8 interpreter?

I'm using V8 javascript interpreter on the command line but it has no tab-completion. Is it possible to add it somehow? ...

What does the exclamation mark do before the function?

!function () {}(); ...

Javascript transitions on CSS scaled images perform poorly

I am working on a front page gallery which has several images, scaled to fit the page via CSS. The images fade from one to the next (overtop of each other), and will resize if the user resizes the browser to use up the space. The problem is that the image fading performs terribly on most browsers and on all but the newest computers. ...

JavaScript Object instantiation

Sometimes I'll see code like this: var Obj = Obj || {}; What does this do? I have had success writing array = array || []; To instantiate an array if it hasn't already been instantiated, however I would like to know a bit more about the mechanics of this. ...

problem with setTimeout "function is not define" !

problem with setTimeout "function is not define" ! What is the problem in this code ? $(document).ready(function(){ function ISS_NextImage() { //ImageSlideShow NextImage $('.ImageSlideShow').each(function() { alert($(".correntImage", this).text()); }); } var t=setTimeout("ISS_NextImage();",1000); }); ...

Is anything wrong with my javascript format?

I'm on a .NET MVC2 project and have a reference to SomeClass.Home.js and jquery in the masterpage. My SomeClass.Home.js looks like this: SomeClass.Home = {}; $(document).ready(function () { SomeClass.Home.SomeMethod(); }); SomeClass.Home.SomeMethod= function () { alert("hello"); }; The call to SomeClass.Home.SomeMethod ...

Remove duplicate string from Array

I have the following dynamically generated arrays: ,<div id="layer0" style="left: 470px; top: 286px;">Some Text</div> ,<div id="layer0" style="font-size: 68px; left: 70px; top: 286px; ">SomeText</div> ,<div id="layer1" style="font-size: 18px; left: 60px; top: 286px; ">SomeText</div> ,<div id="layer2" style="font-size: 18px; left: 50px; ...

Multiple image selection using Ctrl+Click and uploading using PHP

Hello, I need to implement a facebook style multiple image uploader in my PHP application. It should be possible to select multiple files using Ctrl+click. Is there any jquery plugin that i can use or any sample code i can refer to ? Please help Thank You ...

jqGrid text field column

Is it possible to set jqGrid always to show input text field in column? When i set column editable: true it shows input field only if i click on it. ...

How do I generate a number after a button is clicked?

Possible Duplicate: How to create a GUID / UUID in Javascript? I need to have a script that generates random numbers and letters with a form that looks like this: M3KRT-CKKYV-YH4G4-YXP42-46FMT Prefer jQuery, or javascript. I know how to generate number when the button is click using the .click() method in jQuery. But I can n...

Menu stop second function from firing off upon other element using same function

I have 3 menus that use this .toggle and when I switch between menus it requires a second click for the menu to click on again. How do I make the second function stop if another menu is shown? $(".dd").toggle(function() { $("ul a", this).click(function(e) { e.stopPropagation(); }); $(".contextMenu").hide(); ...