javascript

Accessing Nested Objects in Json

I have a custom object which contains other items (ie arrays, strings, other types of objects). I am not sure how to traverse the object to iterate and list all of the object types, keys, and values of the nested items. Second to this issue I don't know how many levels of nesting there are (as the object is generated dynamically from t...

floating menu, make it stop at bottom?

example page I have a floating menu that i've built to the left side (green), and i've made it start moving after 200 pixels. and now i need to to stop and not go over the footer (blue) area. any ideas how to make my JS better? this thing is, I cannot check this on the scroll event, because of the animation going on after i scroll, so...

Lazyweb: Is there something funny about how IE7 does onMouseOver javascript on li elements with text?

I'm an Ubuntu user, so I'm not knowledgeable of Internet Explorer. We have a javascript based drop down menu thingie using li's and ul's and all that. It works fine in FF and IE6. However not in IE7. It looks like IE7 doesn't call the onMouseOver function unless you go over the text in the middle, as opposed to the blank area between the...

Check and control the number of checked check boxes with JavaScript

Hello, I am validating some check boxes and would like for the user to be able to select only 4 (from 7 possible) and disable the others if the current box is being checked(if there are already 3 checked) or enable the everything if the current box is being unchecked. I'm really not sure where's the problem. This is my first experience ...

JavaScript Popup windows Set minimum size?

Well the title says it all is there any way to set the minimum size of a popup window? Edit: My problem is that when some one and makes it as small as he can the content just looks stupid... ...

Problems using window.opener

I have a simple ajax application From this, a popup is launched, with a form. Both the form resultpage, and the ajax application hava a javascript file in common. From the popup window, in the form resultpage, I am trying to call a method from the common javascript file, to apply to the parent window. My javascript file contains an ...

Add Options to select drop down in IE

I'm trying to add items to a select drop down at run time. So far it's working in Firefox and Opera, but it doesn't seem to work in IE7 or 8. What is supposed to happen is that when a user selects a center, then the personnel drop down gets populated with the personnel at the center.... //Clear out the all of the exisiting items if (do...

Is it safe to assume Javascript is always turned on?

Duplicate: Do web sites really need to cater for browsers that don’t have Javascript enabled? Only supporting users who have Javascript enabled. How common is it for Javascript to be disabled How many people disable Javascript? I've been doing web applications on and off for a few years now and each application I write seem...

jQuery: How to select "from here until the next H2"?

I'm setting up a very straightforward FAQ page with jQuery. Like so: <h2>What happens when you click on this question?</h2> <p>This answer will appear!</p> This is all inside a very specific div, so I'll be selecting the header with $('#faq h2'). Simple, right? Click on the H2, and use this.next() to make the next paragraph show up...

Stop a postback in javascript

hello, i have an ASP webform with a JQuery Thickbox, i have an image that opens the thickbox when user click. once open the thickbox it shows me a grid with several rows and a button to select one and after the user select the record it returns to the main page the recordselected and cause a __doPostBack() BUT! sometimes in IE6 it sta...

Is it bad practice to return partial views that contain javascript?

Hi, I am implementing a customer database which lets me search for users and companies, browse and edit their details, and many other things using ASP.NET MVC and javascript (jQuery). Whenever a post or get occurs, I do that via jQuery.load and insert the PartialView into the DOM. Some partial views include forms. I want those to be ...

Automatically detect user's current local time with JavaScript or PHP

I often need to display information based on or influenced by a user's actual local time which differs across time zones. Is there a reliable way of getting a user's current time and/or timezone? Key Issues: Server-side code is based on the website host or user's ISP Client-side code is based on the user's system clock which is too ea...

Javascript String Compare

How could the following code sometimes evaluate to false? (transport.responseText == '1' || transport.responseText == 'CARD_VALID') My code is as follows: if (transport.responseText == '1' || transport.responseText == 'CARD_VALID') { // do something.... } else if (transport.responseText == 'CARD_INVALID' || transport.responseText ==...

ASP.NET DataList - JavaScript Validation Of All Textboxes

Simple setup: Shopping Cart in the form of a data list. Header has two buttons: Update Quantities and Remove Selected Items Each DataList Item has (among other things) a textbox with the id="txtQty" that stores the quantity of the shopping cart item. The user should be able to change the values in these textboxes and then hit the Upd...

Causing a PostBack to a different page from a PopUp

I have a main page and a details page. The details page is a javascript popup invoked from the main page. When the 'save' button is clicked on the details page, I want the main page to 'refresh.' Is there a method of invoking a postback to the main page while also maintaining the save postback from the details page? Edit - Using wind...

When should I use a javascript framework library?

I'm writing a small web that just makes some animation and shows some information as a homepage and a list of links. All that is going to be generated dynamically in the client side. So everything is going to be javascript and XML. Recently I've been reading some questions in SO about javascript, and most of the situations involved the ...

How do you format a line of text within a div when clicked?

Using jQuery or straight javascript, how do you identify / select / choose a single line of text from a div with contentEditable on and add formatting to that line of text only? I currently have a div with contentEditable set to true, which allows the user to edit the content of the div, adding/removing text as they see fit. However, I ...

Dojo Tooltip. dojo.data fetch(). Problems in opera

Weird problem with dojo.data. var store = new dojo.data.ItemFileReadStore({ url: "[myUrl]" }); console.log(temp.fetch({ query:{id:'*'}, onComplete: functionOnComplete, onError: functionOnError })); functionOnError show such trace in opera only: message : Statement on line 16: Syntax error Backtrace: Line 16 of linked scri...

adding javascript widget code the right way

I give customers javscript code that adds a widget to their website. Currently I ask them to paste this right above the </body> tag: <script type="text/javascript"> var myHost = (("https:" == document.location.protocol) ? "https://" : "http://"); document.write(unescape("%3Cscript src='" + myHost + "www.mywebsite.com/mycode.js.php?u="+e...

textarea line breaks javascript

I got a textarea in javascript but the problem is that when i make line breaks in it they won't display how can i do this ? i'm getting the value and use a write function but it won't give line breaks Thanks in advance ...