javascript

PHP filter for non standard characters

I get text as user input and somewhere in the text there are no standard characters, like this. The text is stored to a database. Everything is in UTF-8 and it works well, only it displays strange signs for the non standard characters. How can I filter these characters in PHP? Edit: I discovered that the text with the wrong charact...

Where are Dashboard Widget preferences actually saved?

This is a followup question to my other widget-related question. I'd like to check what's actually written into the preferences of the widget. Where is that data actually stored? ...

Download any filetype from a webserver

I need a link in an HTML page that could use any JavaScript to "start downloading" a normal webpage / file that is on my webserver, either filetypes like PDF / ZIP or simply the outputs of PHP / ASP / HTML. I know this is possible with some server-side download script that returns a *mime_content_type* so the browser handles it based on...

Reading a PHP file variables from external JS

How may I retrieve, by JS (and I mean an external script), the value of some variables assigned in a (php) include file like the one below? <?php $var1 = "a"; $var2 = "foo"; ?> ...

Find the ID after compiling

When you assign something an ID in asp.net such as: <asp:Label runat="server" ID="mylabel" Text="some text"></asp:Label> The code behind ID you use to reference that object is mylabel. However after the site has compiled and is running the ID in the HTML changes to something a bit more abscure <asp:Label runat="server" ID="ct100_bl...

jquery child matching too much?

I am importing a feed into Tumblr and because of the formatting of the site, it shows too many pictures. So to fix that, I thought I would use jquery to remove extra elements. It turns out that the imported feed uses tables. No worries, I made a jquery call that seemed to work fine on an individual post. (Pardon the ugly match) $('....

How to get firefox language setting ?

for example in ie we can use "navigator.systemLanguage" to get language setting but how to get language setting in firefox way? thx your response. Cloud ...

Google maps Polygon question

The following is an example of how to greate a polygon in the google maps API. What is the purpose of latOffset and lonOffset? We're creating an array of points to make a polygon, but what exactly is the offset doing? var map = new GMap2(document.getElementById("map_canvas")); map.setCenter(new GLatLng(37.4419, -122.1419), 13); map.add...

Change Input Type

Hi Everyone: I am working on a fairly dynamic site, and I want the user to be able to choose what they want to input. The input choices are the various types of input (text, password, etc.) Is there some style/way to create this? I was thinking that they choose from a drop down menu and then Javascript takes care of the rest. But I ...

Javascript problems with IE, and Prototype 1.6.0.3

The code below works perfectly fine with Firefox, however, I am having problems with IE 8... and 7... instead of populating the select's with the options returned from my php script (like it does in FireFox) it is doing nothing in IE. I have narrowed the problem down to $('city').innerHTML -- works in Firefox not IE. Any ideas? This...

how to get next week date in javascript

Does anyone know how can I get next week date based on this week date? example if I have this thursday date (25/6/2009) how can I use javascript to get next thursday date (2/7/2009)? ...

Jquery Show/Hide shifts element to the right before showing or hiding

$(document).ready(function(){ var speed = 700; var pause = 3500; function removeFirst(){ $('ul#newsfeed li:first').hide('slide', {direction: "up"}, speed, function() {addLast(this);}); } function addLast(first){ $(first).insertAfter('ul#newsfeed li:last').show(); $('ul#newsfeed li:first').show("slide", {direction...

A Question About RegExp in Javascript

Dear all, I wrote a regular expression ^([+/-]?([0-9]+(.)?)|([0-9]*.[0-9]+))$ I create it by two ways var _regex = "^([+/-]?([0-9]+(\.)?)|([0-9]*\.[0-9]+))$"; var _regexFloat = new RegExp(_regex); and var _regexFloat = /^([+/-]?([0-9]+(\.)?)|([0-9]*\.[0-9]+))$/ ; the testing data is "1a" and "a1". at the second way, it work f...

Concurrent license monitoring for a web page with JavaScript?

What is the good method to implement a cross platform CONCURRENT USERS monitoring for a .HTML page that contains a simple javascript application. The tricky part is that the web servers hosting this html page differ a lot, each customer has their own LMS/Web server, so web page could be running inside IIS or apache etc. ( I have no cont...

Issue with JQuery Sparkline in IE

Hi, I used jQuery sparkline (http://omnipotent.net/jquery.sparkline/) in a page. This gives me problem in IE if the container DIV is not big enough to show it, tried with Firefox/Chrome, it is working fine. See the sample code, <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; <html> <hea...

Capture event onclose browser

Hi! How I can capture event, close browser window, in jQuery or javascript ? ...

Handling click events on z-index'd layers

I have 2 z-index layers in a map application I'm building. I have a problem when I click on the layers to zoom in. The click handler is on the underlying z-index layer and I don't want it to fire when a control in the overlying layer is clicked. The problem i have is that the event gets raised no matter what but the originalTarget pro...

Capitalize first letter of string in javascript

I want to capitalize the first character of a string, and not change the case of any of the other letters. For example: this is a test -> This is a test the Eiffel Tower -> The Eiffel Tower /index.html -> /index.html ...

Lightbox with IFrame is flickering when clicking on links...

Hi all, I've got the same problem with this post: http://stackoverflow.com/questions/877449/how-to-fix-flickering-in-iframes Unfortunately, there's no solution (and I'm afraid of negative ratings too :) ). I can't provide a page where you can see the behaviour (as it's intranet) - but I'll try to explain it: When I open an external p...

Create multiple Upload File dynamically

I was wondering if anyone knew the best way to dynamically create an upload form? Here's what I'm trying to achieve: The code shown below allows one upload, I want to have a button that when pressed, should add another form for file upload. So, if I want to upload - let's say 7 files, I want to press the button 7 times to create those ...