javascript

Javascript generated combo box order of item in chrome is upside down

Hi all, I got a javascript code I wrote that calls a web service returns some data and populate the results in a combo box. However I ran into a problem where the ordering of items for the combo box is upside down in Google Chrome. In other browser such as IE and Opera it is in its order from the way the script populate the list of item...

Google Gears "upgrade" never completes.

I am using a website/program that we had developed in JavaScript, and it utilizes Google Gears to maintain an offline site. This software is distributed to our clients, and there are roughly 300 users currently. I will sometimes get a rogue issue (maybe 3 times in the last year) where Google Gears prompts with "A gears update has been do...

Adding HTML object to DOM using JavaScript. Showing blank.

Hi, I'm attempting to creat a HTML button using JavaScript (seemingly simple), yet for some reason the object isn't being placed on the page. Do I need to append it to the DOM or somehow create an instance of it? Here is my code: function loadNavigation() { var backButton; backButton = document.createElement('input'); backButton.ID =...

need to changed markup with jquery to work with thickbox iframe (2nd attempt)

This is a revised attempt at solving this issue. Excuse my noobness. I have the following markup on a page of which I do not have direct access to... <a href="javascript:void(0);" onclick="window.open('/BulkDiscounts.asp?ProductID=318&ProductCode=' + escape('LB30X40ES') + '&Orig_Price=22.95', 'Discounts', 'scrollbars,status,resizable,w...

Access Full-Page zoom setting with javascript in Safari 5?

Is there a way to programmatically access a page's current zoom-level in javascript with Safari 5? I'd like to access it with a Safari extension, but I'm coming up empty in the documentation. I'd also be interested in any other creative ways to mimic full-page zoom (maybe with CSS?) that could be done with the new extension system in Saf...

Adding zeros when length is less

Is there a smart way to convert numbers to string and automatically add zeroes so the length is the same as the maximum? like this: for (var i=0; i<30; i++) { var c = i.toString(); if (c.length == 1) { c = '0'+=c; } } But smarter ...

Tooltip on button click using jquery

How can I show an error message using tooltip on click of a button and that too if there is error, else the button should just work fine to submit the form? Here is what I have tried with modal dialog $.fx.speeds._default = 1000; $(function() { $('#dialog').dialog({autoOpen:false,show:'blind',hide:'explode'}); $('#savej').click(funct...

How do I track hotlinking of images and iframe?

I give out an embed html code so others can post parts of my website as an iframe. I want to be able to track who has my embed code posted. Is there a way to do this? ...

How to create Hash object/array using jquery?

Hi folks I know there is a Hash() object in the Javascript prototype framework, but is there anything in Jquery like this? As I would like to stick with one javascript framework, rather than mixing the Prototype Frame work and the JQuery framework and use at the same time, as I worry there will be conflict and create side-effects. So ...

regular expression for validation not working

I have a "description textarea" inside a form where user may enter a description for an item. This is validated with javascript before the form beeing submitted. One of the validation-steps is this: else if (!fld.value.match(desExp)){ And desExp: var desExp = /^\s*(\w[^\w]*){3}.*$/gm; Now my problem, this works fine on all cas...

Conversion of Facebook PHP string to Javascript

$facebook->api_client->stream_get('','','','','','app_YOURAPPLICATIONID',''); Oh dear, shows that I'm lacking motivation.. What I would like is to have the Javascript equivilent of that line. ...

Simple question about javascript history.go

I have a classifieds website. In every classified, there is a back link which simply takes the browser back one step. This is because when users search classifieds, and click on one to view it, they can easily go back with a link also (instead of only the browser back button). Here is the problem, if the classified is entered directly i...

javascript apply #hash to all links

How can I append #somehash to all links on a page without depending on a JS framework? Or is it possible to catch when someone clicks on a link and attach #somehash? ...

Javascript: using a wildcard character with a replace method

Hi all I have a String that contains a line of html code eg. '<b>1995</b>'. Let's say this String could also contain '<b>1997</b>' or '<b>1999</b>' etc. I want to use a replace method to remove the tags but leave the years. Is there a way to implement a wildcard character to do this, something like: first_string = "First year is <b>199...

How do you assign a JavaScript 'onclick' attribute dynamically?

Hi, I'm creating a button dynamically using JavaScript and at the same time assigning attributes such as 'ID', 'type' etc and also 'onclick' in order to trigger a function. All works fine apart from the assignment of the 'onclick'. When clicked, the button is not triggering the function as it is supposed to. the function I'm trying to ...

JavaScript distributed computing project

I made a website that does absolutely nothing, and I've proven to myself that people like to stay there - I've already logged 11+ hours worth of cumulative time on the page. My question is whether it would be possible (or practical) to use the website as a distributed computing site. My first impulse was to find out if there were any J...

jQuery: How to use modifier keys on form submit?

Say I have a form that looks like this: [ Animal name input field ] Add button If I type a name and hit enter, an animal with the given name is added to a table. Works fine. What I would like now is to call the current way of working "quick add" and add a new feature called "slow add", which I am not quite sure how to do. Basically...

JavaScript check if anonymous object has a method

How can I check if an anonymous object that was created as such: var myObj = { prop1: 'no', prop2: function () { return false; } } does indeed have a prop2 defined? prop2 will always be defined as a function, but for some objects it is not required and will not be defined. I tried what was su...

Determine if user navigated from mobile Safari

I have an app, and I'd like to redirect the users to different pages based on where they are navigating from. If navigating from web clip, do not redirect. If navigating from mobile Safari, redirect to safari.aspx. If navigating from anywhere else, redirect to unavailable.aspx I was able to use http://stackoverflow.com/questions/273876...

Error when trying to refer to a field by name

I am getting an error (document.my_formm.fieldName.value is null or not an object) from the below code: <html> <head> <title>(Type a title for your page here)</title> <script language=JavaScript> function check_length(my_formm,fieldName) { alert(fieldName); alert(document.my_formm.fieldName.value); } ...