javascript

Javascript/DOM: On a dynamically created form text object, how do you reference the value via DOM?

I have an array that looks like this: grades[0] = ["A", 4.0, 0, "a"]; grades[1] = ["A-", 3.67, 0, "a-minus"]; grades[2] = ["B+", 3.33, 0, "b-plus"]; grades[3] = ["B", 3.0, 0, "b"]; grades[4] = ["B-", 2.67, 0, "b-minus"]; grades[5] = ["C+", 2.33, 0, "c-plus"]; grades[6] = ["C", 2.0, 0, "c"]; grades[7] = ["C-", 1.67, 0, "c-minus"]; grades...

Dropdown list trigger jquery?

Can anybody know the exact reason for this, why drop down is not opening using trigger function. Can anybody Explain this! $('select').trigger('click'); Thanks. ...

Javascript solution to print specified area. Cross-browser friendly.

Hi Guys, I am currently developing a site which requires a print option on the page. When clicked this button fires a script that prints all contents within a <span id='printArea'></span>. I am using a jQuery plugin called printElement at the moment and it works very well in all browsers that I have tested except Google Chrome. I have...

Using Context Menu On Fancybox Image Popup

I integrated this right click context menu into my website: http://abeautifulsite.net/blog/2008/09/jquery-context-menu-plugin/#download my problem now is when I use fancybox to show an image, I can't seem to find a selector to target so i can use my custom context menu when i right click on the fancybox image popup. Any ideas? ...

IE6 javascipt on click image swap problems

On my webpage I have images that function as checkboxes (image switch and set hidden form property value). It works in every browser except IE6. Does anybody have a clue what is causing this problem? The code: function flip(element) { var formElement = document.getElementById(element + "Form"); var imgElement = documen...

How to make sure ES3 programs will run in an ES5 engine?

So ECMAScript 5 introduces some incompatibilities with ECMAScript 3. Example: Many articles have been written stating that this === null || this === undefined is possible in ES5 strict mode: "use strict"; (function () { alert(this); // null }).call(null); But, what the standard really suggests is that ES5 engines also allow th...

Using Javascript to resize browser window in IE8. Explanation mostly.

Hi All, I have seen many examples on using javascript to resize a browser window, but for me they all fail to perform that function in IE. I include my code to see if anything is wrong with it that I just don't see. The code works great in FF but that is not used at my location. I am no javaScript expert, but I am no slouch either. ...

Can you use jTemplates for "Two-way bindings"?

Hi all.. Just toyed around with jTemplates today, and I love the idea. I was hoping I could find something similar to the data-binding model of WPF in it though, but so far I'm out of luck. Are anyone aware of such a model/framework? [EDIT] To clarify, I'd like something like MVVM, where I can have a back-end datasource in json format...

Saving a web page and externally linked assets as an independent static resource

Hi All, We have a requirement to cache web pages as accurately as possible, so that we can go back and view a version of a page at any previous point in time. We'd like to be able to view the page as it really was - with the right css, javascript, images etc. Are there any OS libraries (any language) that will fetch a page, download al...

How could I change window's location without reloading and # hack?

At first I thought that hash hack is a requirement, however judging from the recent updates from facebook, I am thinking otherwise. The original hash hack (I am not sure if this is the correct term) is that by changing location.hash, one may save a state in the URL without refreshing the page. That is extensively used by Google's apps, ...

Element height unknown before it's rendered in IE6; how to solve?

I created a lightbox script. One javascript issue remains and it is driving me crazy. The source is to be found at http://github.com/Wolfr/Wolf-lightbox In IE6, when you click the image, the modal box position is wrong the first time you click the modal. If you close it and click it again, the modal is positioned correctly. I believe...

need help in passing URL parameters to variables

hi all. i need help with a little code that i have below. i'm a newbie in javascript so i hope someone could help me here i've used the function below to grab parameters from URL: <script type="text/javascript"> function gup( name ) { name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^&#]*)"; ...

Update Google Maps Javascript objects every 1 min using fresh data from database using C#??

Hi all! I'm trying to update a Google Map (API V3) with markers using my friends locations stored in a database. I want to refresh the map every minute or so... kind of like google latitude which shows where yours friends are on the map. Here is SOME of my Javascript: Please note that all i need to do is get a list of locations from the...

Position label over select and open select on click

I am trying to create a drop-down effect same as that shown in GMail. When u click a label a drop-down should open and the user should be able to select values. I think it can be possible by aligning a label / div over the select such that only the allow of the select is visible and when a user clicks on the label or arrow the drop-down...

Web OS final year project

Hi guys. i m a final year student and planning for my project. i have given my thought on devoloping a web operating system using HTML,JS,CSS with linux support. Do provide me some suggation and tutorial or sourcecodes(if any) thank u. ...

Most Efficient Way to Find Leftmost div?

Using jQuery or straight Javascript, I'm looking for the best way to find the leftmost div (or in general the DOM element with the minimum or maximum position on either axis). So far I have two solutions: Iterate through the div objects that I want to consider, saving the smallest left position found. Build an array of objects and us...

Detect if a checkbox is checked, then get div id

I have checkboxes on a page, when you click a span for each checkbox, it will change the background color of the containing div for each checkbox. The problem is when someone submits the form and goes to the following page, then clicks the back button the checkboxes remain checked but the div color reverts. Is there a way to get the div ...

replace selected text in contenteditable div

I have been looking high and low for an answer but failed. Is there a cross-browser solution to replace selected text in contenteditable div? I simply want users to highlight some text and replace the highlighted text into xxxxx. ...

Change name of iframes/frames dynamically

Hi I'm trying to have a website that hosts different applications (also websites) in iframes. Note: only one application is active (displayed) at a time. My problem is that links that rely on targets are loaded in the wrong iframe (the first that is found). To avoid problem with links that rely on a specific target, the script changes ...

Moving pictures with Javascript

Hi, I have a problem with my site, or at least I think I have. I use a very simple nearly recursive Javascript function to move two pictures. However, on my four year old computer, this is not a smooth movement. I've reduced the size of the pictures, but... The code is not recursive as I use setTimeout between calls. The code is the fo...