javascript

Keeping jQuerys .change() from running on page load

I have a page that has multiple select lists and when ever one of the select list changes using jQuery's .change() function I change the text in a span next to the select list. When the page loads there is already some text in every span (the text different for each span). The problem is that when the page loads the .change() function lo...

How can I write javascript functions in content page html and how I call that function

I write two javascript functions in content page. Then I take a html textbox and on the onkeypress event I try to call those two functions, but I am running that application and I didn't find any output to help me. Here I am trying to count number of characters in textbox on keypress event. If I write a javascript function in simple pag...

JSLint "Unsafe character"

I was happily using Douglas Crockford's JSLint on Mac OS X and my code passes, but after I got a Ubuntu Hardy Slicehost server and uploaded my code there, the JSLint no longer passes when I try to run it on the server. It fails on my localized files that contain umlauts. I get errors like: Lint at line 1206 character 25: Unsafe charact...

Is there any way to force reload a page with a JavaScript query?

The title might be a bit misleading, but I don't know how else to explain it. Basically I'm at this URL: www.mysite.com/shop/6-dresses#filter=[manufacturer:4] And I want to make a link that would change it to www.mysite.com/shop/6-dresses#filter=[manufacturer:5] (e.g. like <a href="www.mysite.com/shop/6-dresses#filter=[manufactur...

JavaScript: declaring and defining a function separately?

If I want to give a JavaScript variable global scope I can easily do this: var myVar; function functionA() { myVar = something; } Is there a similarly simple and clean way -- without creating an object -- to separate the "declaring" and the "defining" of a nested function? Something like: function functionB; // declared wi...

Getting the scrollbar height of a browser

Is their any javascript code to get the scroll height. I mean the scroll bar is how far from the top. Please help me thanks in advance ...

Another file permissions problem

I have a classifieds website, and when users post a new classified, they may chose to upload images. My php code takes the chosen image, uploads it to a image folder, and names it accordingly. The problem here is, I have to set the images folder to 777 in order for this to work. My question is, what should the permissions be set to? A...

script onload/onerror with IE(for lazy loading) problems

I'm rebuilding my lazy loader module to accept asyncronus request but i have a BIG problem: internet explorer don't support script.onload/onerror!!! The old script did globally eval the target script source read with an ajax sync call, it works very well,it's cross browser and i can make it async editing 1 variable but it's very tricky ...

Trying to create dynamic select boxes with Javascript and jQuery

I'm not a front-end developer and I'm trying to create a select box and add its options totally dynamically using Jacascript and jQuery. I'm almost there but am having a problem adding each new select to the div block (the number of selects is different at different times. So far, I can either get the last select created in the followi...

Mystery on submitting POST request

$.post('scripts/spedisci_mail_controllo.php', function(mail_spedita){ /*this prints void alert*/ alert(mail_spedita); /*this prints void alert*/ if (mail_spedita=="1"){ $('#message').load('pagine/message_mail_controllo_spedita.html', function(){ mostra_messaggi(); }); } else { ...

Fill textboxes based upon current Dropdownlist (database items) selection (asp.NET MVC)

I have a dropdown box in my view which is populated with objects from database. Now what I want to do is, based upon selection in the Dropdown fill various textboxes with property values of the object selected in the dropdownlist. There are numerous examples where you copy the selected dropdown value in the textbox using JQuery / JavaS...

why wont jQuery remove() work in this case?

Im trying to cause a canvas element to be added to the DOM and then removed after a set time. The killbox() function gets called, but the element is not removed. I believe I have the syntax right, and that there is some underlying issue with removing dynamically added DOM elements. //con is short for console.log() function spawnCanvas(...

How to access an object property from a callback function inside its method?

I am defining this class: function GMap(map, marker, geocoder) { this.map = map; this.marker = marker; this.geocoder = geocoder; this.setMarker = function(address) { this.geocoder.geocode({'address' : address}, function(results, status) { map.setCenter(results[0].geometry.location); marke...

Check if javascript is enabled on all (most) browsers?

Possible Duplicate: How to detect if JavaScript is disabled? I have a website which uses a lot of JavaScript. I need to check if JavaScript is disabled, then redirect user to a certain "enable JavaScript please" page. I need to do this before everything else is loaded on the index.html page of my website. Does anybody have ...

Why does this code changes location as I need it to

Hi, I have a weird question. I have been writing a code to change the view by a <select>'s onchange like this: <% Html.BeginForm(); %> <label for="id" >Automat:</label> <%= Html.DropDownList("id", Model as SelectList, new { @onchange = "window.location.href = document.getElementById('id').options[document.getElementById('id').selectedIn...

How javascript try...catch statement works

I am trying to test in browsermob if certain input field work or not. I am attempting to use a try...catch statement which I have never used before. I know that the form is: try { //some code } catch (){ //some error code }; What exactly is supposed to be put in the parenthesis after the catch statement? When I try to use the statemen...

Getting timezone for JavaScript and PHP all mixed up.

I'm trying to synchronize the timezone between a PHP script and some JavaScript code. I want a PHP function that returns a timestamp in UTC. Does gmmktime() do that? On the JavaScript side, I have: var real_date = new Date(); real_date -= real_date.getTimezoneOffset() * 60000; real_date /= 1000; Does this convert the timestamp...

Wait for message to send in window.onbeforeunload?

I'm messing around with Safari extensions, and I'd like my extension to respond to the user opening or closing tabs. I have the extension injecting a script that runs when the new tab opens and notifies the global page that there's a new tab open. I want the script to also notify the global page when the tab closes. To do this, I'm havi...

reducing line height on cufon text

Having a problem reducing the line height on a Cufon heading. Using the line-height property but doesn't seem to do anything, p.s I've checked for any conflicting CSS rules, any wise words? :) This is it http://www.warface.co.uk/clients/detail-shoppe Its the header under the 'New' Bubble I would like to tighten up ...

JavaScript: How to get the center of a pie slice?

Hi I am trying to create a simple pie chart using the HTML canvas element. I found a nice tutorial on the web and starting to learn how it is done. Now I want to add some text and since I am pretty retarded at math/geometry I need to know how to find the center of each slice in the pie where the text can be added. Here is the loop code...