javascript

Maintaining state of dynamically-generated checkboxes

I'm using jquery to dynamically create a list of checkboxes. However, when there's an error, I need to preserve the state of the checkboxes. I have this working, but it seems a bit kludgy: get the value from the posted form, put it into viewstate, put the value of the viewstate var into a hidden field, get the value of the hidden fie...

How can i know the width and height of html elements ?

i want to know the width and height of the html elements like divs body and tables. is this possible ? i want the calculated width,height and not the one that i apply to the elements. using jquery would be fine. thanks ...

equivalent of jQuery's "load" in prototype

Hello, I am trying to find an equivalent for the following jQuery javascript: var x1 = setInterval(function() { $('#status').load("processor.php", {value:'name'} );}, 5000 ); I need to use Prototype for other applications on the page, and when I throw both jQuery and Prototype libraries in there they will not cooperate. Thank you, ...

How do I select a row in a table based on what ddl option is selected MVC?

I have a table with a few rows of data. I would like to display a row based on what option is selected on the ddl. how do I do that? <script type="text/javascript" language="javascript"> function optionSelected() { alert('HELP!!'); } </script> ... <select id="optionSelect" onchange="optionSelected()"> <option i...

External Javascript Timeout

I have a number of tracking scripts and web services installed on my website and I noticed when one of the services goes down, it still tries to call the external javascript file hosted on a different server. In Firefox, Chrome and other new browsers, there doesn't seem to be any issues when one of the services go down. However, in IE7...

DateTime to javascript date

Hello, From another answer on Stackoverflow is a conversion from Javascript date to .net DateTime: long msSinceEpoch = 1260402952906; // Value from Date.getTime() in JavaScript return new DateTime(1970, 1, 1) + new TimeSpan(msSinceEpoch * 10000); But how to do the reverse? DateTime to Javascript Date ? Thanks, AJ ...

Conditional "Get Script File" in Javascript without using a library function

I work at a company that has many clients that have their own website that "plugs in" to our system. In other words they have their own website and they have a link that, when the user clicks it, transitions them over to our site. There is a feature that I want to track by giving the client a small block of code to put on their homepag...

how to provide html/js widget for users

Hello, How can I share html/js widget? Javascript, iframe or what way is good? Now I have html page, css file and js file. I want to share this widget with people so they can attach it to their blogs, websites etc. ...

Passing Data in Dynamically generated links with Javascript

The Question: Here is how I am passing data with js. Is this a good way to go about it or am I doing it wrong? It does work but it seems... suspicious, I suppose, to my relatively noob JS skills. I have a custom grid plugin that generates a grid of data. Let's say it generates rows of user names with their id #, role, some dates, etc. ...

Why would html source not change when the DOM is updated dynamically

I had posted one question earlier http://stackoverflow.com/questions/2381621/jquery-inconsistency-in-setting-readonly-attribute-in-ie-8-and-ff-3-5-8 and was quite happy with the answer. But I did notice that if you update (any??) DOM elements dynamically, then view source (using browser's view source) I find the the updated DOM element ...

asp.net textbox with java script problem

I'm trying to check if asp.net textbox is empty or not using java script. my code working ok but if I enter only numbers will conder it empty so I have either enter letters and numbers or only letters. Please advice. here is my code <script type="text/javascript"> function check(){ var txt = document.getElementById('<%=txt.ClientI...

Same-origin policy workaround using document.domain in Javascript

I am running into same-origin policy issues in Javascript. I've read about a workaround for this using the document.domain variable, but I cannot get the workaround to work. The workaround is that you are supposed to be able to set document.domain to 'example.com' so that if you run code from foo.example.com it can load data via XHR fr...

javascript plugin - object oriented?

intro Hello, I'm trying to develop some plugin or/*and* object in javascript, which will control some properties over some object. It will also use jQuery, to ease development. idea This is in pseudocode to give you an idea, since I can't really describe it in english with the right words, it's impossible to go and use google to fin...

Is there a way to fix the width of drop down list?

Here is what I got: <select id="box1"> <option>ABCDEFG</option> </select> <select id="box2"> <option>ABCDEFGHIJKLMNO</option> </select> I have 2 different Drop Down lists. Since the width of a drop down list depends on the width of the longest text in the option, I end up with 2 drop down lists with 2 different widths. This ...

Ruby on Rails 3 Beta: On ajax get request, I can't respond back with the html.erb view. Is there a work-around?

I have began playing with Rails 3 beta and I am trying to do my usual starter project. I create a simple list of projects, but use ajax requests for the app's navigation. In Rails 3, my usual code does not work for the basic scaffold, I receive an ActionView:MissingTemplate (Missing template projects/new with {:format=>[:js]} Here is...

AJAX call in for loop won't return values to correct array positions

I need to get a range of pages using AJAX and put them into an array, where their given place in the array is equal to the i of a for loop (it's a caching-like function for blog pages, and the range of the for loop is entirely variable). I'm doing something akin to the following: var bongo = new Array(); for (i = 0; i < 10; i++) { ...

Difference between window.location.href=window.location.href and window.location.reload()

What is the difference between window.location.href=window.location.href and window.location.reload() in JavaScript? ...

ExtJs add panel as tab item

I have a setup where the tab is expected to be loaded based on user selection of an item from a left panel tree. My objective is to load only the relevant items as per the user selection to a particular tab. The first time, I am able to add item as below: var tab = tabs1.getItem('Orders'); tab.remove(0); tab.add(pane33...

jQuery DatePicker - defaultDate using $_GET['date']

I'm having troubles with the following code: <link type="text/css" href="http://jqueryui.com/latest/themes/base/jquery.ui.all.css" rel="stylesheet" /> <script type="text/javascript" src="http://jqueryui.com/latest/jquery-1.4.2.js"&gt;&lt;/script&gt; <script type="text/javascript" src="http://jquery-ui.googlecode.com/svn/tags/1.8rc1/jqu...

How to pass a parameter to a javascript through a url and display it on a page ?

For instance, I have a url like this : www.mysite.com/my_app.html How do I pass a value " Use_Id = abc " to it and use javascript to display on that page ? ...