javascript

Is Flash becoming a dying web technology? (long-term)

I'd like to see what your thoughts are regarding Flash and it's purpose in the future. We all know what some of the pros and cons are for using Flash but with HTML5 growing rapidly, I can see Flash becoming less useful (perhaps even obsolete) unless new features are added to it. Take for example complex animation, fancy fonts, dynamic ...

jQ, On dropdownlist change/selection, get request on same url with ?somekey=selected-item-value

When someone selects a drop down list item, I want to redirect to the same page but with the querystring set with www.example.com/?somekey=selected-value where selected-value is the numeric value of the option. I am using jqeury if that makes it easier. ...

Can a JavaScript object property refer to another property of the same object?

I recently tried to create an object like this: var carousel = { $slider: $('#carousel1 .slider'), panes: carousel.$slider.children().length }; My intentions were to improve jQuery's selector performance by caching the results of $('#carousel1 .slider') in an object property, and to keep the code concise and relatively...

Design of caching for a medium/small web app?

I have a web app that's currently ~700 LOC in JS (more is serverside). I'm using jQuery. As I find myself trying to minimize AJAX requests to the server, I've got an awkward mix of caching and spaghetti code developing. It feels like I need a more centralized solution. My idea: Create a map with the AJAX call to make (URL and args), and...

js/css changing cursor

I'm using css/js to change the class of an element which the pointer is hoving over. The class determines the custom cursor image. Unfortunately, it seems as if the cursor does not update in Chrome unless I physically move the mouse. Unfortunately the app is primarily used through the keyboard, however the cursor image is pretty importa...

Better way to see if an array contains an object?

I have an array of items (terms), which will be put as <option> tags in a <select>. If any of these items are in another array (termsAlreadyTaking), they should be removed first. Here is how I have done it: // If the user has a term like "Fall 2010" already selected, we don't need that in the list of terms to add. for (var i = 0...

Toggle element visibility via radio select

This form has a hidden textara and a visible textbox. I would like to swap visibility of these elements if option "D:" is selected, but not sure how to correctly check which radio button is checked at any given time: <script language="JavaScript" type="text/javascript"> function unhide(event) { event = event || window.event ; ...

Split a string in jquery

How to split these strings in jquery? Mode1 2Level I want to get only the numbers from the above two strings in jquery... The strings may be Mode11,Mode111,22Level,222Level etc the characters Mode and Level wont change... ...

Useful Vim plugins for web development and design (php, html, css, javascript)?

Right now I'm using surround.vim to enclose text in HTML tags, and a plugin that highlights text according to the hex value in the CSS file (e.g. #888 will have gray background in the CSS file). Are there other useful plugins for web development? Recommendations Here is a list of the plugins mentioned in the answers so far: surround...

element onChange javascript not working

<select name='cmg_select' onChange="javascript:window.location.href='index.php?'+this.value"> <option value='pening'> pening </option> <option value='complete'> complete </option> <option value='pening'> pening </option> </select> concatenation not working..... ...

Store users hashed PW in localstorage?

I'm writing a web app for 100 users where I work. It is accessible on the internet, not just our intranet. Many users are unskilled users, though most use Chrome as that's the browser that's default on their laptops. To auth with the web app this is a potential plan: User enters password Password is sent to server Password is hashed a...

how to pass these strings from php to javascript

hello i have 4 strings in my application like this that i want to pass to my js file $a1='[10,20,13,14]'; $a2='[17,15,14,16]'; $a3='[18,24,16,17]'; $a4='[15,54,18,27]'; echo $a1.",".$a2.",".$a3.",".$a4; and my javascriptcode is $.ajax({ type: "POST", dataType: "json", url: "loaddata.php", ...

Getting a cookies parameters in PHP?

How do you get a cookies params? The "expire, secure, httponly" etc. Is it possible? ...

Identify the applet to which was dragged file

I am using Java applet as a box for uploading files. Choosing files from file system and dragging them on applet cause adding file pathnames into the input text box. The design is currently following: Each 'Upload' button is surrounded by an applet for the drag-n-drop, a radio box and an input box. Each radio box has its own id. The dra...

Javascript remove numbers after the dot

Hi there, Lets say i have this number: 1.5676556 But i want it to show only 1 (without rounding, lets say i have 0.6, if i use math.round, it will round it to 1) tnx in advanced. ...

What does 'Error: uncaught exception: Syntax error, unrecognized expression: [object Object]' mean in jquery?

I keep getting this error, but it doesnt give me a line number or anything. 'Error: uncaught exception: Syntax error, unrecognized expression: [object Object]' That is the error, from this script: http://www.fissiondesigns.com/simon/ try drawing a square on the picture. Thanks in advanced! ...

Fetching the title of a website

Hi there, I browsed through SO, but what I found were examples "how to manipulate a piece of html". But in my case, I want to fetch a HTML file by a given URL and just parse the websites title not the whole file. Is there any way to do this with jQuery or any jQuery like framework? regards, ...

How to process javascript function called onload in the background?

Hi, I would like to know if it's possible to process the code in a particular javascript function that is invoked during page onload in the background. i.e. few labels and textboxes are sent to the browser by the server. During onload, a function gets invoked to immediately hide them. But, I see that because of using it in onload, the ...

javascript: lat/lon, lat1/lon1, bearing, distance to x,y screen coordinates?

Hi all, how to project a lat/lon hotspot onto an 360x180 degree panorama image? Using javascript? Real data: lat/lon in decimal degrees and altitude in meters: Camera coordinates: 49.994249, 8.66539, 2 Hotspot coordinates: 49.994163, 8.665388, 2 Distance camera to hotspot in meters: 9.55 Compass bearing camera to hotspot in degrees ...

How to disable default <a> behaviour of "href" attribute ?

I have a simple sidebar like this: <div class="sidebar"> <ul class="nav"> <li class="Page1"><a href="Page1.html">Page1</a></li> <li class="Page2"><a href="Page2.html">Page2</a></li> <li class="Page3"><a href="Page3.html">Page3</a></li> </ul> </div> This code exist on each one of the pages: page1.html, page2.htm...