javascript

extjs null data should load empty grid

When the user select an item with info (json), the grid renders as expected. But, when the returned data is null or {"total":0,"Products":null}, the grid keeps the previous selection. The page is here: If the returned data is null, I need it to render it empty. I am loading the grid as below: ProductsEditDataStore.basePar...

Escape a white space character using Javascript

I have the following jquery statement. I wish to remove the whitespace as shown below. So if I have a word like: For example #Operating/System I would like the end result to show me #Operating\/System. (ie with a escape sequence). But if I have #Operating/System test then I want to show #Operating\/System + escape sequence for s...

How to prevent page's scroll position reset after DOM manipulation?

I've got two JS functions, one that is adding options to a select box function addOption(selectId, text, value) { var selectbox = document.getElementById(selectId); var optNew = document.createElement('option'); optNew.text = text; optNew.value = value; try { selectbox.add(optNew, null); //page position reset...

Intercept page exit event

When editing a page within my system, a user might decide to navigate to another website and in doing so could lose all the edits they have not saved. I would like to intercept any attempt to go to another page and prompt the user to be sure they want this to happen since they could potentially lose their current work. Gmail does this ...

Calling Javascript in a page after it's been loaded by jQuery GET

Imagine a normal page calling javscript in head. The trouble is some of the content isnt loaded untill i click on a link. Subsequently when this link loads the content it wont work. This is because i guess the javascript has already been run and therefor doesnt attach itself to those elements called later on. There is only standard h...

What is the difference between var thing and function thing() in JavaScript?

I was just wondering about the difference between the following declaration of JavaScript objects. Specifically, the difference between thing object literal and thing1 object from thing class. Code: var thing = { sanity:0, init:function(){ //code }, send:function(){ //code } } function thing(){ ...

When using building my yahoo widget getElementsByTagName returning elements not nodes

I can see that itemNodes is a DOM nodelist containing the same number of entrys as number of titles. I want to access the information inside the title node. I have tried using itemNodes.childNodes[0].nodeValue I receive the error An error occurred: TypeError: itemNodes.childNodes has no properties placing itemNodes.item(i) inside the ...

ext-js data associate

can you associate a component or element in ext-js with a arbitrary object? eg. store(component, 'key', obj), get(component,'key'); ...

jQuery: Count Number of Inputs with a Specific Value

I need to count the number of text inputs with a value of 1. I have tried the following but with no luck. $('.class[value="1"]').length $('.class:contains("1")').length Using $('.class[value="1"]') technically works, however, if the values in the text input are changed after load, it still counts it as its default load value. I too...

Re-executing JavaScript files

I asked this sort of question before ( http://stackoverflow.com/questions/1309694/application-fails-to-dynamically-reload-javascript-files ) but I couldn't quite resolve the problem (if it has any solution), so I will put this in another fashion, a simpler one: Can one unload a file from the browser's memory for posterior reloading? (Re...

radio button jquery ie6 problem

i am dynamically creating radio using jquery as shown belown. but they value only selected in ff,ie8. ie6,ie7 not selecting the values. how can i select the radio button value in ie6/7. rand=$("<input type='radio' ></input>"); rand.attr("checked","checked"); $(document).append(rand); ...

Images on Hover

I have an issue best shown by example: http://dont.net/DesigningIntro/index.html Here the last "Car Exterior" is opened fully, but not properly opens as like other small bars. It gets hidden while hovering on other links. I want it to be shown, and not get hidden even if I hover on other tabs. Any suggestions? ...

Modify javascript code to iterate through all variables in the form

I have the following code that worked fine till now as I decided to add more variables to the form. How can I make this function smart and itterate and pass all the variables in the form? function getquerystring(strFormName) { var form = document.forms[strFormName]; var word = form.clock_code.value; qstr = 'clock_co...

Is there a way to sync column widths in an html table?

If I have these two tables: <table> <tr> <td>Small Length Content</td> </tr> </table> <table> <tr> <td>Dynamic Content Goes Here And It's Longer Than The TD Above</td> </tr> </table> How can I make it so that the two columns have the same width? I can't combine the tables so thats not an option. I also can't use fixed widths since i...

Re-insertion of <script> tags

Insertion of a file's tag, thus executing the file's code. Removal of the file's tag. Insertion of the same file's tag. Firebug does not seem to acknowledge and does not show the reinserted tag when the file's has already been inserted before. It does upon new insertions, of course. EDIT: Is this a problem of some kind? (the file...

Can I modify or add cookies from JavaScript?

Exactly what are the restrictions for handling browser cookies from javascript? Can I check if cookies are enabled for example? ...

Why is my jQuery plugin for removing text on focus and re-adding it on blur not working?

I would like the text in the value field of a text box to disappear when that text box gains focus, and then reappear in response to the eventual blur event - but only if the value is empty (that is, if the user hasn't entered anything after putting focus into the text box). So far, I have this: this.each(function() { obj = $(this...

Checking if a form field is numeric while using Jquery to get its value

Basically, I'm doing this: var phone = $("#phone").val(); Then I want to check if: 1) Phone contains only numbers 2) Phone contains at least 10 digits But the problem is, from my experience, using $("something").val() returns it as a string so isNaN() fails. But I don't want use parseInt() either since it will change strings into ...

Sutable plotting lib for comet tecnique?

Could you recommend me the best plotting lib for this task? It should run on a browser (javascript or flash) and It have to let me add points from javascript code in a way like: myPlot.add([x,y]) so I can push data from the server and have real time graphics. Today I'm using flot (jQuery based). Where the task is not as straight as m...

What is the correct string format of the datetime with milliseconds from javascript to c# code

This will result to an error because c# variable testDate is different in format from the Javascript variable testDate jquery: $.getJson url= "/Home/GetJasonData" testDate = '1/1/2009 10:01:01:123' controller: void GetJasonData(DateTime testDate) { } ...