javascript

How can I simplify this jquery?

I have the following jquery which I want to simplify. I am just repeating the same things. Could anyone give me suggestions please. Thanks in advance. $("a[rel='imagebox-all']").colorbox({slideshow:true}); $("a[rel='imagebox-new']").colorbox({slideshow:true}); $("a[rel='imagebox-even']").colorbox({slideshow:true}); $("a[rel='imagebox...

Submit Value With Javascript

Hi All, Im a little stuck with the following function. Please note, Im a total noob with javascript/ajax, so please bare with me: <script type="text/javascript"> function removeElement($parentDiv, $childDiv){ if (document.getElementById($childDiv)) { var child = document.getElementById($childDiv); var par...

How can I use the jQuery Autocomplete plugin for linked input fields?

I'm using the jQuery Autocomplete plugin. I have two input fields on a form, inputfield1 and inputfield2. I attached autocomplete to the first field. When the that field loses focus, I want to check if a value was entered and if so, then make an AJAX call to retrieve some "\n"-separated strings and use them to drive autocomplete on the ...

JS spam protection

How to use JS spam protection on email to hide the form from spam bots. ...

what is wrong in this code??

im using the following javascript function function showUser(cats1,cats2,nam_cat) { document.getElementById("eq").style.display=''; document.getElementById('eq').innerHTML = '<TABLE cellpadding="3" class="b bc r w4"><TR class="ln g"> <TD class="l"><B>'+nam_cat+' Schemes</B></TD> <TD><A HREF="#" onclick="AlphaSort(\'scheme_1_mo...

Regex Expression Problem...

I have the following regular expression /[^a-zA-Z0-9 ]/g I want include " in the following piece of code onKeyUp="this.value=this.value.replace(/[^a-zA-Z0-9"]/g,'') I used the above regex The problem I am facing over here is that the above regular expression allows me to include other special charaters (&, *, etc.) into it. How do...

Reddit Style Voters with jQuery

I am trying to copy reddit's voting buttons but I'm somewhat new to jQuery so I'm having challenges. My HTML block looks like: <ul class="karma-controls"> <li class="karma-control karma-up karma-up-selected"><a href=""></a></li> <li class="karma-total">1</li> <li class="karma-control karma-down"><a href=""></a></li> </ul> ...

Is there a way to simplify this jquery?

I wrote a dropdown menu with the following structure. It is supposed to drop down on click, and close on click. Here's the HTML <ul id="nav" class="nav"> <li> <a id="menu1" class="menu">MENU 1</a> <!-- top menu --> <div id="submenu1" class="submenu"> <!-- hidden by default --> <a href="#">SUBMENU ITEM 1<...

What to use to create bar, line and pie charts with javascript compatible with all major browsers?

I used to work with flot but it doesn't support pie charts so I'm forced to change. I just saw JS Charts, but their documentation is very obscure regarding cross browser compatibility (I need it to be IE6+ compliant :). Also this will be for commercial use, so I'd rather have something that I can use free of charge jQuery Google chart...

How to change the content of "This field is required" in Jquery form validation plugin?

How can I change the general message of "This field is required" in Jquery form validation plugin to "このフィールドは必須です"? The color of the message can be changed by using the following code: <style type="text/css"> label.error {color: red;} </style> But how to change the content? I want to change all "This filed is required" messages. I...

How to use regEx to return false when data not in range?

Sample data: Hello I'm 301 I need a regex to allow A-Z a-z 0-9 and space(s) only. All other characters are not allowed. If detected, return false to javascript. Based on the sample data above, it should return false because got a character which is not accetable===> ' How to write this in js. ...

Flash, AJAX or something else for a web-based demo interface?

My company has some software which we use to acquire data and interact with some hardware. If we wanted to put a mockup on a website which allows the user to get a feel for the UI (gather some data, change some settings etc.), what are some good methods to do so? I'm thinking either some clever javascript or flash. I've done some JS bef...

Move scroll of a div with jquery

Hi, Im trying to move the scroll of a div with jquery, but i dont know what im doing wrong. Here is the code that im using: $("#CategoryList").animate({ scrollLeft: "=-5" }, "slow"); where CategoryList is the ID of my div with scroll. Could you give me a hand? Thanks in advance. Josema. ...

Google Maps/Javascript issue with map 'undefined'

Hi there, Hope someone can fix this (hopefully simple) issue I'm having. We've got a Google Map pulling in Geo-Coded data from a web service, which returns an array of results. Also, it geocodes the UK post code of the user and plots a yellow 'home' marker on their location on the map. This works fine in IE, but the marker does not d...

jQuery - find child with a specific class

Hi, I am trying to write code to search all children for a div that has a specific class. The DIV does not have an ID. Here is the HTML I will be using. <div class="outerBUBGDiv"> <div class="innerBUBGDiv"> <div class="bgHeaderH2">Technology Group</div> <div class="bgBodyDiv"> <div align="center"> <img height="33" border="0" width="1...

Simulating a click in jQuery/JavaScript on a link

I want to simulate a click on any link on a page using JavaScript. If that link has some function binded to its 'onclick' event (by any other JS I don't have any control over), then that function must be called otherwise the link should behave in the normal manner and open a new page. I am not sure that just checking the value of the '...

Passing a parameter as a pointer in JavaScript

Take a look at the following code: var o; (function (p) { p = function () { alert('test'); }; })(o); o(); // Error: 'o is not a function' In the above function I am creating an anonymous function that takes one parameter, which self-invokes with a previously-created object passed as a parameter. Then I am pointing th...

Image Dpi using javascript

Can I know an image dpi (horizontal and vertical resolution) using javascript ? ...

Modify js to accept an image instead of a text string

I'm trying to figure out the correct syntax for this. How can I modify ('<a href="http://www.link.com" target="_blank">name here</a>') accordingly so it can accept an image instead of text? Here's my script: s = new slide(); s.src = '0001Work.jpg'; s.text = unescape('1%20of%2012'); s.textb = unescape('<a href="http://www.link.com" ...

JavaScript: the event object

Why can the event object have no properties? I get this error in Mozilla Firefox while in IE and Opera all is well. Please, follow this link to see the problem: here was the link ...