javascript

Check if the spacebar is being pressed and the mouse is moving at the same time with jQuery?

Is there a way to check if the space bar and at the same time track what direction the mouse is moving and how far etc. Point of this is that I want to replicate how Photoshop scrolls when you hold the space bar, left mouse button and you move the mouse, but without having to hold down the left mouse button. ...

Ruby Watir: Clicking OK on JavaScript Alerts?

Seems none of the code I've tried has any affect. My intention is to close any and all JavaScript prompts that may come up by hitting the "OK" button. Problem is, my script has no affect on the prompts that come up. In other words, it does nothing. Here's what I have: fx = FireWatir::Firefox.start(somepage) fx.startClicker("OK") fx.but...

JavaScript: Refactoring looping regex

How might this be improved, as it pertains to the loop and the regex replace? var properties = { ... }; var template = element.innerHTML; for (var name in properties) { template = template.replace (new RegExp('\\${' + name + '}', 'gm'), properties[name]); } element.innerHTML = template; Is there a way I could get all the...

DataValue of Lookup field is always null.

Hey guys, I'm using MS CRM 4 in IE8. On the Order Product form, I am attempting to use the OnChanged event of the Quantity field do give some feedback to the user based on the current value of the Product lookup field. My problem is that no matter what I do, the DataValue property of the field is always null. Here's the javascript I'...

How to use javascript regex to check for "empty" form fields?

Hi All: I am working on a php+javascript based project and have already made up a mockup page at : my website I knew how to use javascript or php to check whether a particular field of form is "empty"or not, that is, whether it contains alphanumerical characters other than whitepsace characters(for instance, space, tab and newline). H...

setting maximum value for a text box in php

hi how to set a max value for a text box in javascript ..... eg.. the value must be with in 100... no greater value must be entered i my task i am using two text box where i am inserting marks ... the first text box my marks will be out of 80 the second will be out of 20 i am calculating the total of 1st and 2nd mark and the r...

using a simple jquery script to have a div follow the page on scroll

I'm trying to use this script here: http://css-tricks.com/scrollfollow-sidebar/ to make a simple div that follows the window as the user scrolls. I changed it from 0 to topPadding and changed topPadding to topPadding*2 to get the right top offset. Unfortunately this has the side effect of the object making the page a little longer and a...

Anyone know a good Javascript Prompt for the User to upgrade their browser...

I am trying to find a good way to notify visitors to our site to upgrade from IE6 to get full functionality. I see lots of this in use. Anyone know a good source for it? ...

Initializing singleton javascript objects using the new operator?

Hi In javascript, what is the difference between: var singleton = function(){ ... } and var singleton = new function(){ ... } ? Declaring priviliged functions as described by crockford (http://www.crockford.com/javascript/private.html) only works using the latter. ...

how to count total number of divs with in a div using javascript

how to count total number of divs with in a div using javascript ...

How to encode 2 dimentional PHP array to Javascript Array?

Here's my problem, i have a php array like this: $output = array(array(1,1,1,1),array(2,2,2,2),array(3,3,3,3)); after the array was encoded to json i got this: $output = {"1":[1,1,1,1],"2":[2,2,2,2],"3":[3,3,3,3]} all i want is to pass the PHP array to Javascript so that the JS looks like this: var output = [[1,1,1,1],[2,2,2,2],[3...

Internet Explorer jquery :contains issue

I'm trying to parse a simple xml document with jQuery. Does anyone know why the following works fine in Chrome and Firefox but not in Internet Explorer (7 and 8)? var selBunit = $("#bunit").val(); $(bunitXml).find('bunit bname:contains('+selBunit+')').parent().find('team') Below is a snippet of the xml. So basically I'm trying to retu...

Can Indy run Javascript?

There is a software product called AnyChart which is great for embedding Flashed based charts in web pages. AnyCharts can also export to PNG file format. Here is an example: <script type="text/javascript" language="javascript"> //<![CDATA[ var chart = new AnyChart('http://www.mysite.com/swf/AnyChart.swf'); chart.width = 60...

jquery jeditable and multiple fields

I'm pretty new to Jeditable and I was wondering if there is a way to generate and submit a custom form with multiple fields instead of just one field? I've taken a look at this tutorial for some hints and I've made a bit of progress. I'm not sure if I'm on the right track though. ...

a href tag to place a link

I have to place a link to a webpage through an <a> .The webpage link contains some request parameters and I don't want to send it across through the browser directly (meaning I want to use something similar to POST method of FORM). <a href="www.abc.do?a=0&b=1&c=1>abc</a> I am using this inside a jsp page and is there a way to post it ...

What's the default javascript library used in symfony 1.4?

I'm reading a tutorial for 1.2,which says prototype is the built in library : http://www.symfony-project.org/book/1_2/11-Ajax-Integration What about the newest version of symfony? I'm only familiar with jQuery,is there an easy way to replace the default by jQuery? ...

How to determine if it is day or night in javascript or jquery?

Hi guys, Im wanting to apply different CSS sheets to my site depending on the time of the browser. e.g if its day time, display day.css or night.css for night. I can do this with PHP but it is based on the server time, not the browsers local time. Is there a way to tell the time in javascript? I'm probably going to use jQuery to simpl...

disabling text box in html?

hey all, i've got some js code that populates an input field with a name, when a number is selected. once the name is populated, it can't be edited. the problem is, when i disable the field and submit the form, it doesn't submit the disabled value. and i can't seem to make the field work by making it a readonly field. what other option...

how do I create a widget of my web application

Hello everyone, I want to create a small widget of my website. This widget will facilitate easy viewing of latest content posted on the website embedding it on other website. posting of comments instantly to my website from within the widget How shall I start building such widget. I heard of this CROWDSOUND, and this is exactly ...

Protected email with Javascript - how the code works?

Can somebody disassemble that and explain to me how it works? That's protected email link. <script type="text/javascript"> //<![CDATA[ <!-- var x="function f(x){var i,o=\"\",l=x.length;for(i=0;i<l;i+=2) {if(i+1<l)o+=" + "x.charAt(i+1);try{o+=x.charAt(i);}catch(e){}}return o;}f(\"ufcnitnof x({)av" + " r,i=o\\\"\\\"o,=l.xelgnhtl,o=;lhwli...