javascript

HTML + Javascript form submission question

I have authored a html + javascript form which displays a set of images along with a submit button. The user can select the images he or she is interested in and when the user clicks the image, I change the image border to indicate image selection. And when the user clicks on the submit button, I would like my server side script to rec...

js automatic value assigning

hi friends, I want some type of javascript to do like below I have a text box to enter phone number And its like this 111-111-1111 when a user start to type means when he types 111 then the "-" must come there automatically. then again he types 111 "-" it should come automatically. how can i do this??? please help Thanks ...

how to dynamically add a value to a drop down in rails

if I have a drop down on a page that lists some values which are in a DB table. next to the drop down I have something which when clicked makes a text box. Kind of like Edit in place. is it possible to type some value there hit enter and have that value be loaded up in the drop down? ...

Is there a good way to prevent jQuery from being redefined?

I encountered a problem that took me some time to debug where a plug-in that I was using for jQuery (in this case jFeed) was not working. The problem ended up being because we also used Amazon Associates product previews. The product previews code ends up including a number of other JS files through document.write(), including another co...

Please tell me what is error in this javascript code

i have written following code to access public variable of asp.net onclick event on button but its not giving me desired output.. please check it: <asp:Button runat="server" CssClass="txtdisplay" ID="Button1" Text="Browse all jobs in area" OnClientClick="return navigateURL('index.aspx?c=<%=cityid %>')" /> ...

scripting adds with document.write vs. jQuery append

I have taken time to review many of the discussions on this topic but have not found an answer to my question. In my site I am trying to optimize my page load speed and one of the ways I would like to do that is to move the my ad scripts to the bottom of the page to allow my content to load first. I still want the ad to show up in the m...

jquery scale losing position

i have an absolute positioned img which i make it to appear using jquery scale effect...it works fine in firefox..in all other browsers this is what happens.. the img initially appears in a wrong position... the effect happens...then it comes to the position i have applied...is it a problem of scale effect...? Update- the code css.. ...

how to force reload of web page every five minutes only if active

I would like to have my web-app reload html every 5 minutes. One way I can do that is by using adding HTML header: <meta http-equiv="refresh" content="300" /> But this has an issue that even if the page in question is not active, it will go on reloading all the time. By active, I mean the browser window is on foreground and the page i...

How to check in Javascript if one element is a child of another

Hello, How can I check if one DOM element is a child of another DOM element? Are there any built in methods for this? For example, something like: if (element1.hasChild(element2)) or if (element2.hasParent(element1)) If not then any ideas how to do this? It also needs to be cross browser. I should also mention that the child cou...

Updating FusionChart component with JavaScript

An html page contains FusionCharts component. Below this component are a couple of html controls supposed to filter date for this component. Initially, there was a problem updating the chart component, upon clicking "Filter" button I used the following code: currentChart.setDataURL(url); currentChart.render("ChartDiv"); It didn't work...

What is benefit of using (function(){...})() in JavaScript

I noticed in JQuery that the following code structure is used (function(){var l=this,g,y=l.jQuery,p=l.$,...})() Which seems to create a function, and call it. What is the benefit of taking this approach versus having the contents of the function inline? ...

'variable' was used before it was defined.

I am checking if a variable is defined or not, and if it is not defined explicitly I am going to define it by doing: if ( typeof(aVariable) == 'undefined' ) { var aVariable = value; } Because the variable is not defined JSLint warns that it is used before it is defined, and that is exactly what I want. What is the best practice to ...

Is it possible to change Facebox's settings at runtime? How?

Is it possible to access Facebox settings? For example, I'd like to do set the location of the loading image dynamically (see line 4): <script type="text/javascript" src="<?php echo base_url(); ?>media/facebox/facebox.js" ></script> <script type="text/javascript"> $(document).ready(function(){ Facebox.loadingImage = '<?php echo...

Bluring the page and displaying gif image when processing.

Hi, I am using c# ASP.NET VS 2005 . I have a functionality where i have to click on a upload button and the data has to be uploaded from selected input file to database. When i click the upload button its taking atleast 40 sec to upload the data from the file. I want to display some gif image to the user when the data is being uploade...

Setting a variable to undefined

Hello, I'm a bit confused about Javascript undefined & null. Firstly what does if (!testvar) actually do? Does it test for undefined and null or just undefined? Secondly, once a variable is defined can I clear it back to undefined (therefore deleting the variable). Thirdly, can I pass undefined as a parameter? e.g: function test(var...

In ExtJS, how do I load a store when I display a grid?

In ExtJS, how do I load a store when I display a grid? I want the store to load only when the grid is displayed (the user clicks on a button to show the grid, so it's wasteful to load the store beforehand). I tried the afterrender listener but it renders the loadmask in the wrong location, and the afterlayout listener reloads the grid ev...

Ajax issues in IE 6, 7, 8

I am having Ajax issues with IE (6, 7 & 8). I am using the Simple AJAX Code-Kit (SACK) v1.6.1 which works fine in FF, GC, Opera and Safiri. In IE it throws the error: System error: -1072896658. Breaking on JS error on line 157 (self.response = self.xmlhttp.responseText;). /* Simple AJAX Code-Kit (SACK) v1.6.1 */ /* 2005 Gregory Wild-...

Javascript: Adding ellipsis to HTML text according to container size

I have a div which contains text. The text should be shortened to two lines and "..." added at the end to point that there's more. Since the font and font size may vary according to different users' settings (for example: browser "text size" settings, different browsers, etc.), I need to do this dynamically on the client side. What is...

mouseover captions flashing when moused over

problem can be seen here: http://www.studioimbrue.com/beta The code: $(document).ready(function(){ $('div.caption').hide(); $('.captions ul li img').hover(function(){ $(this).siblings('div.caption').fadeIn('medium'); }, function(){ $(this).siblings('div.caption').fadeOut('medium'); }); }); Not sure wha...

How to determine if the location of the iframe has changed?

Hi all, I have got an iframe that displays a form from an external site,once the form is submitted it is redirected to another page that has got a thankyou message.Is it posiible to know from the iframe if the location of src webpage has changed? i hope im making some sense... i got this code which will do the job for me from some webs...