javascript

Boolean operators in a switch statement?

Is there any way to make this work with a switch, syntactically? switch(i){ case ('foo' || 'bar'): alert('foo or bar'); break; default: alert('not foo or bar'); } ...

JavaScript to trigger PHP

Is it possible to have an input text box such that when a person types something and presses submit or enter, I can trigger PHP to submit that data to a database without leaving the page (hence the JavaScript)? ...

jQuery align table (number of rows/cells) based on screen resolution

I have a table like this (8 cells only for illustrative purposes, may be more or less): [1] [2] [3] [4] [5] [6] [7] [8] Each item in each cell is roughly 450px wide, so they fit comfortably next to each other on a 1920x1200 screen (which, incidentially, is mine). However, I need this configuration to change automatically and align the...

How can I open a popup window from an iframe through javascript?

Is there any way to do that? ...

Calling one parameter in another function ?

Hi Actually i want to take url and id from one fn to another whether this method will work. function addElement(url, id) { alert(url); var main = document.getElementById('mainwidget'); main.innerHTML = "<iframe src=" + url + " align='left' height='1060px' width='576px' scrolling='no' frameborder='0' id='lodex'></iframe>"; ...

Give ID/Class to generated images

Hello. I have 10 or so images coming in from flickr. At the moment they just come in as images with no individual ID or Class names. So I have: <img src="images/01.jpg" width="300" height="273" /> <img src="images/01.jpg" width="300" height="273" /> <img src="images/01.jpg" width="300" height="273" /> <img src="images/01.jpg" width="30...

Whether it will alert ?

Hi is this correct <a href="#" style="color:#FFF;"onclick="add('alert("Google !")');" id="cricket" tabindex="1" name="cricket">cricket</a> ...

how can add multiple values one textbox to another textbox in javascript?

hi <script type="text/javascript" language="javascript"> function addElement() { var ni = document.getElementById('occupation').value; var numi = document.getElementById('theValue'); numi.value = ni; </script> i use this code for add one text box values to another but this code work only for add one value not multiple value so ...

How to style "input file" with CSS3 / Javascript ?

I would like to style <input type="file" /> using CSS3. Alternatively, I would like user to press on a div (that I will style) and this will open the Browse window. Is that possible to do that using HTML, CSS3, and Javascript / jQuery only ? ...

How to break Visual Studio 2010 JavaScript debugger from script

Is there a JavaScript command that will cause the Visual Studio 2010 debugger to break? Trying break(); didn't work because it's only valid within loops. Also stop(); failed because it picked up that stop() doesn't exist and I didn't have a useful stack trace. ...

Mysterious "_gaq is not defined" error... _gaq isn't even referenced anywhere on the page!

EDIT: This question is solved, but I can't accept my own answer just yet. Howdy! So I've got a PHP/CodeIgniter webapp. I've got some custom Ajax-based tracking code inserted into my page - however obviously, for testing purposes, I don't want this code to fire when I'm running the site locally on my development computer. In order to a...

Async xmlhttprequests failing, synchronous aren't

I'm running into a strange problem. In the following sample code, if I set asynchronous to true the request fails and Chrome tells me 'failed to load resource'. However, if I switch it to synchronous it goes through fine. Additionally, if I do multiple xhr requests using this code and its set to async, all requests exhibit the same prob...

tweet.id is undefined

While using Tweetmeme for tweeting, I get the following error. The weird thing is it happens only on some of the pages. tweet.id is undefined Message: 'id' is null or not an object Line: 1 Char: 4543 Code: 0 URI: http://zulu.tweetmeme.com/button_ajax.js Edit: I noticed that some pages where it is failing have space in its Url. ...

Basic HTML/Javascript - Creating an Image Navigator - How to dynamically load images ?

Hello guys, I am buidling a small image navigator where the user inserts an image number and it has to load in the page so he can view it and do some processing on it later. The images will be physically named 1,2,3,4,5.jpg for example. Any quick code that i can use to make the corresponding image load I know this is fairly simple ...

How to save the input values of an HTML page?

Now, this requirement may seem weird. But i would like to know how to achieve this? I am having an HTML file, which is having few input box, check box, radio button etc. I would like to retain the changes a user [ actually i ] performs on this page. Like if the user has ticked a checkbox then next time anybody open that file should see t...

setInterval with other jQuery events - Too many recursions

Hello, I'm trying to build a Javascript listener for a small page that uses AJAX to load content based on the anchor in the URL. Looking online, I found and modified a script that uses setInterval() to do this and so far it works fine. However, I have other jQuery elements in the $(document).ready() for special effects for the menus and...

Javascript - Connect two lines

In the following picture: I want to connect the boxes in the above with below, Let us call the bottom edge of the top boxes as A and top edge of the below boxes as B Now, I have two arrays containing the points in the line A nd B say A = [ {Ax1, Ay1},{Ax2, Ay2},.... ] and B = [ {Bx1, By1},{Bx2, By2},.... ] In real world it can be ...

fbconnect authentication window don't closed

Hi, I have created an application which uses fbconnect. The application uses new facebook graph api(javascript sdk). The problem is do not close the authentication popup window after authenticating. It shows a blank page. My code is <script type="text/javascript"> window.fbAsyncInit = function() { FB.init({appId: mixin.fb_connect_a...

Parse PHP Session in Javascript

Hey everyone, I have recently gone into extending my site using node.js and have come to realisation I need a session handler for my PHP sessions. Now everything was cool and dandy and node.js reads the php sessions and can propogate it's own session with the php ones. I am using database sessions so the session data gets saved into a f...

Hiding/Encoding my javascript code

Can I hide my javascript code on the client side??? Or some way make it non-readable not by users but by hackers as well?? ...