javascript

Should i modify the prototype of String?

I was about to create a trim function in javascript, but as i don't want to reinvent the wheel i googled for this method. I found this link http://www.somacon.com/p355.php The Solution it provided is: String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,""); } String.prototype.ltrim = function() { return thi...

edit-in-place jquery

Hey I use edit-in-place plugin: http://arashkarimzadeh.com/jquery/7-editable-jquery-plugin.html I't works Great! I just need something to check if the new text is empty. If it is we have to go back and show some error alert. The code: $('.name').editable({ submit:'Gem', cancel:'Fortryd', ...

Need advice on working on large javascript files

Hi. I have about 2000 lines of javascript code for my application. A lot of this is user interaction / jQuery. Don't worry, it all works fine :) But it's getting dificult to keep track of the code base. So I have split up the file into five files. I thought that if I load all files, they all reside in memory and the can communicate wit...

JavaScript Character Issue When Filling Dropdown With jQuery From External JS File

Hello, I'm running into a character encoding issue when I load a dropdown using jQuery from an external js file. This only seems to happen when the JavaScript object is not within the page. For example the below is the JavaScript object. var langs = [ {value:'zh-CN', text:'中文 (简体) Chinese Simplified'}, {value:'en', text:'English'...

I wrote a tab control but I cannot get the css to work in all browsers, how do I fix it?

Using CSS, there are basically two classes, one for the tabs default colour, and a "selected" CSS class that is applied using javascript to whichever tab is clicked. The control fuctions perfectly, but the dynamic CSS only works in IE7 and IE8. The code is basically this: for (var i = 0; i < group.children.length; i++) { child = g...

How to show extended option in select list?

While using fixed width select tag , there is one bug in IE. When the content of the option in the select tag is more than the width of select tag its hide. Its working fine in fire fox , not in IE. ...

How do I do OuterHTML in firefox?

Part of my code I get the OuterHTML propery "<LI onclick="TabClicked(this, 'SearchName', 'TabGroup1');">Name " so I can do stuff involing parsing it. There is no OuterHTML property in javascript on firefox though and I can't find an alternative way to get this string. Ideas? ...

Refire certain scripts after jQuery AJAX load.

I need certain scripts to refire after an AJAX load. How could I accomplish this? ...

overwrite javascript_tag to put all inline javascripts at the end of the page (for better performance)

For better frontend performance, it's best practice to put your scripts at the very end of your HTML code. I did that for a pretty big and complex page I'm working on right now and the problem I run into are many inline scripts in the views, mostly generated by Rails' built-in JavaScript helpers. These scripts depend on the libraries th...

Is it Possible to use the structs tags inside the Javascript Function ???

Hi all , Is it possible to use the structs tags(logic:equal, logic:match) inside a javascript function? Actually I need to set value in the <td> of the table dynamically getting from the Bean. How can I achieve this? ...

JavaScript inside Ajax - Internet Explorer

I would like to add a Javascript at the end of some ajax content, It works fine on firefox but internet explorer print the script without running it. <script type="text/javascript"> $.tablesorter.addParser({ id: 'title', is: function(s) { return false; }, format: function(s) { s= s....

Dynamic Javascript appending with location.href attribute and ajax-cross-domain.com script.

After assigning this: window.onload = initfunction; I want to append the AJAX cross domain script to the header: function initfunction() { var dh = document.getElementsByTagName('head')[0]; var script = null; script = document.createElement('script'); script.setAttribute('src', 'http://whatever.com/cgi-bin/ACD/ACD.js?'+location.hr...

Get row data in Ext JS 3.0 Grid

I have a grid, which I want to add a button at the top to get the data from a specific column for each row selected in the grid. How would I go about doing this? ...

Parsing date like twitter

Hi. I've made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What's the best way ? Thanx. ...

Is it possible to reload a form after an input type="file" changes?

Is it possible to reload a form after 'file-input' change? I have a form where the user can chose an image for upload. I also have a php script which displays that image resized. I only wonder if it is possible to reload a form OnChange of the file-input and then call the php code which uploads the picture, so that the user can preview ...

Displaying a Multidimensional Array in a Bar Graph (in JavaScript)?

Hey Is it possible for someone to give me a few pointers on how to display a multidimensional array in the form of a bar graph? The array is multidimensional, with three elements in each part - and the elements are determined by a HTML form. So if it is possible to display this kind of array in the form of a bar graph in Javascript on...

javascript debugging question

Hi all, I have a large javascript which I didn't write but I need to use it and I'm slowely going trough it trying to figure out what does it do and how, I'm using alert to print out what it does but now I came across strange alert output: [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine's clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use Flash? My primary target is IE8, but would like to support FF and Chrome also. I have seen the technique to do this using Flash, but am loo...

How do I pop up an alert in Javascript?

How do I pop up an alert in Javascript? I tried alert"HELLO" but that didn't work. Can someone tell me the correct syntax? ...

Best practice of big javascript objects

Hi all, sry for this imprecise topic name. I am querying a dataset a lot of times so using ajax request would end up in tons of http requests. For this reason I decided to use the json encode method to store this particular data set in my javascript code. My php code looks like this: (no json.parse) echo 'var myDataset = ' . json...