javascript

How to increase speed of getElementById() function on IE or give other solutions ?

I have a project using Javascript parse json string and put data into div content. In this case, all of itemname variables is the same div's id. If variable i about 900, I run this code in Firefox 3 for <10ms, but it run on IE 7 for >9s, IE process this code slower 100 times than Firefox I don't know what happen with IE ? If I remove...

How do I add an alert when the user tries to press the back button or is using firefox? (Javascript)

Just need a little bit of Javascript to warn people that press the back button that it might screw up their transaction with an Ok/Cancel button, and also a way of detecting if they are using any version of firefox. ...

What is the most effective way to create a reference to this HTML element using plain JavaScript?

If I have the following HTML: <div id="container"> <iframe></iframe> </div> What is the most effective way (mainly in terms of performance) to create a reference to the <iframe> DOM element? I'm using something like the following: var element = document.getElementById('container').getElementsByTagName('iframe')[0]; IIRC, though, ...

Load and run an EXE file after a website loaded

Is there a way to load and run an EXE file on the client side, after a webpage has been loaded ? [with java script or HTML ] ...

How should I store and retrieve UK pound symbols?

Hi all, This is a problem I come across every so often; I always end up writing some horrible bodge, but I'm sure there must be a correct way to deal with it (after all, it's surely not uncommon to want to work with UK pound symbols). The problem: the user enters a UK pound symbol (£) into a textfield in the CMS. They click save, and t...

get the id/value/name of checkboxes generated in form with rails

I'm using a fields_for helper in rails with some text boxes. How can I get the ID of these text boxes to use in some Javascript? I would like to be able to manipulate the status of the other checked boxes by clicking on certain boxes. Thanks :) Stuff like: <% fields_for "[id][]", app do |fields| %> <%= fields.check_box :featu...

How can I check to see if a forward history exists in Javascript? (Disabling back button)

Got a window.history.go(1) to stop the user hitting the back button, but was wondering if I could check to see if a forward history exists before doing it, so I can display a popup warning the user not to press the back button. I know you can get the history length, but is there a way to get the current position in the history list? Or ...

onreadystatechange event problem in AJAX call??

Hi, The problem seems very strange. I have a AJAX helper function within a same aspx file and onreadystatechange event is handled like this xmlhttp.onreadystatechange = function(){ if (xmlhttp.readyState == 4) //do some opp } this works fine. i can read the xmlhttp value inside the callbac...

Execute Function On First Run Of Greasemonkey Script

How can I run a function upon the first run of a greasemonkey script? ...

Datepicker in Javascript.

What is the best way(pattern) to Create datepicker in Javascript. I have created one using Singleton pattern, but am not satisfied. ...

Visual effects in Javascript.

I am looking for a book, tutorial or something like where I can learn to Create visual effects like Scriptaculous for example http://wiki.github.com/madrobby/scriptaculous/effect-fold Thanks in advance. ...

querystring encoding of a javascript object

Do you know a fast and simple way to encode a javascript object into a string that I can pass via GET? No jQuery, no other frameworks, just plain Javascript :) ...

ExtJS: dynamically ajust layout after adding/removing some form fields

I have form layout with some TextField elements and one HtmlEditor element. Some TextField elements are "hideable", i.e. could be hid or showed. After hiding/showing elements HtmlEditor instance break layout — there appear empty space or element doesn't end at the window border. Is it possible to tell to HtmlEditor instance use all rema...

asp:DropDownList - invalid postback or callback argument when adding options via JavaScript/jQuery

I have two dropdown lists: <asp:DropDownList ID="Field_Type" runat="server" /> <asp:DropDownList ID="Field_SubType" runat="server" /> Field_Type is databound, with a list of types, populated from a database. Field_SubType is set via jQuery / AJAX when Field_Type is changed. I then add an option using $("#<%# Field_SubType.ClientID %>"...

how can we disable resizing of new popup window in firefox?

i tried openeing a new window using window.open("lookup.htm","lookupWin", "height=400,width=500,resizable=false"); it works fine in IE, but in FF the pop up is still resizable. How to disable this resizing in FF as well? ...

Trigger event from JavaScript

Let me try and be as much clear as possible although it won't be easy. OK, I have a circle inside div, and I know the x and y coordinates of the circle inside this div. How could I create JavaScript or HTML tooltip to point at the spot where I clicked (in this case the circle)? Here is the image so you can better understand what I'm t...

Javascript: Trigger an event that happens in a few seconds, but be able to cancel that event if another event happens?

Disclaimer: I am anything but a Javascript expert, so I'm not even sure if I'm approaching this correctly... I want to be able to trigger an event in Javascript, but be able to cancel that event if another event occurs. So, what I'm looking to accomplish is: User begins typing in a text box. When textbox contents change, trigger an ...

JavaScript Confirm Does Not Work?

Hi, I use girdview. and for deleting I use LinkButton in each row. protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if(e.Row.RowType == DataControlRowType.DataRow) { ((LinkButton)e.Row.Cells[12].Controls[0]).Attributes.Add("onClick", "return false;" ); } } Now, I w...

How to load xml-file with JavaScript in not-IE browsers?

I have the next code which works fine in IE: xml=new ActiveXObject("MSXML2.DOMDocument"); xml.async=false xml.load("docs.xml") How to do the same (without Ajax) in other browsers? ...

jQuery - overwriting events?

Hi all, My page contains some drag-able div elements ( not jQuery UI dragable ). Now we want to add a new feature: the user should be able to select more than one div at a time and drag these div elements without triggering the previous bound events. Now here is my problem: Is it possible to disable the mousedown, mousemove and mouse...