javascript

OOP Diamond problem for php files - How should I deal ?

I have file A.php that includes file B.php and C.php. Now both B.php and C.php includes D.php. D.php has some div tags, javascript functions/variables which all conflict. :( I could copy paste code from D.php to B.php and C.php and rename functions/div tags. Is there a better solution that I could use ? ...

Pass a php variable to dynamically generated div's onclick event

hi, how to pass a php variable to dynamicaly generated div's onclick event? here is my code while($rowset = mysql_fetch_array($result)) { $idTT1++; $editTT='b'.$idTT1; $hidTextTT='t'.$idTT1; $hidSubIdTT='s'.$idTT1; echo "<tr><td>".$rowset[1]." ".$rowset[2]."</td><td> &nbsp; </td> <td class='table_label'> <...

highlight code using mootools1.2

Hi all, I am using mootools1.2 as my js framework. I have one problem regarding the highlight my some html element when page gets load. I need to highlight my error message if any on page when page loads. For example. When page load then error div have #FFFFFF as bg color. For highlight it will use #FC0000 as a bg color and then aft...

Javascript keystroke trapping when characters entered very rapidly

We are writing an ExtJS application that relies in large measure on trapping a users keystrokes. However I believe I have discovered a "timing issue" in that, when the keys are pressed too rapidly, unexpected behavior manifests, specifically in our case, duplicate entries get added to an array being buffered in memory. I have an idea f...

Linked pulldown lists using MySQL, PHP/JavaScript/Ajax/jQuery

I am quite new to web development and have a task to develop a web application that will basically show the user 5-15 pull down lists on one page, where each selection will limit the choices in all other lists. The user should be able to start with any one of the lists (so no set selection order) and when the user have selected something...

What's the maximum number of operators you that can be used in an if statement?

Hi, i'm using jquery and I'm trying to validate a form. My question is - What is the maximum number of tests can you give in a single if statement. function cc_validate () { if ($("#name").val() == "" || $("#ship_name").val() == "" || $("#address").val() == "" || $("#city").val() == "" || $("#ship_city").val() == "" || $("#state").val()...

Getting text in label that holds both text and checkbox

Hi, <label><input type="checkbox" id="Exep1" checked="checked" onclick="Do(this);"/> My label text here</label> I used : function Do(T){ var XcEP = $(T).parents().html().match(/^[-\s]*(.+?)[\s()\d]*$/,"i")[1]); alert(XcEP); } The function above alerts: <input type="checkbox" id="Exep1" checked="checked" onclick="Do(this);"/> My l...

Flash based cropper like this, but with source or customizable?

I am looking for a Flash based image uploader with resize and possibly rotate function. I have checked many possibilities, and the very best in simplicity and unser experience I found is Kroppr at a very affordable €29/license. The downside is, it comes with encrypted PHP code to bind the product to a subdomain. That is understandable...

refresh parent page from jquery dialog.

I want to refresh the parent page when I close my jQuery dialog. this is the code I use for my dialog. I tried top.opener.location but it did not do nothing but put me on top of the page. $("#dialog").dialog({ height: 700, width: 600, closeOnEscape: true, title: 'View', close: function(event, ui){ to...

How to work on Javascript projects?

I am trying to write my own Javascript Framework something like jQuery. I use Aptana Studio for designing websites. I was planning to create a web page and write the Javascript code just as we would do for a website. Then I noticed that Aptana Studio also has a Javascript Project. So I created a new Javascript Project. But it primarily...

Testing with multiple regexps at the same time (for use in syntactic analysis)

I am writing a simple syntax highlighter in JavaScript, and I need to find a way to test with multiple regular expressions at the same time. The idea is to find out which comes first, so I can determine the new set of expressions to look for. The expressions could be something like: /<%@/, /<%--/, /<!--/ and /<[a-z:-]/ First I tri...

Jquery Validation Plugin Method required( dependency-expression ) use ok but callback not working

Hi all, i'm trying to make this work; this validate is applied to a payment form, and as you can see, there are only 3 requierd inputs, if and only if input[type=radio]:checked').val() != "CB"; wich means if user is about to pay with something else than a credit card. Following is the complete code to validate my form. $("#paiement"...

What's the best way to write a portable Javascript library?

All of my projects include very similar tasks and quite recently I've been thinking I should write a library to handle most of the heavy lifting so I can write short, simple, easy to read code that interacts with the library to get the jobs done. Looking at other frameworks, specifically jQuery & YUI, they work in different ways. jQuer...

-webkit-tap-highlight-color: rgba(0,0,0,0); on a div?

Is there any way to apply this to a div? ...

ASP.NET with Javascript disabled

Hello As you probably know, ASP.NET injects some javascript code to the form, like so: <script type="text/javascript"> //<![CDATA[ var theForm = document.forms['aspnetForm']; if (!theForm) { theForm = document.aspnetForm; } function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false...

Javascript - How to make auto select another drop down.

Here have two list field menu. First brand second item I want if we select brand IBM that item will select IBM too In other hand, if we select brand HP that item will select HP too How to do that in javascript. <select name="brand"> <option>Please Select</option> <option>IBM</option> <option>HP</option> </select> <select na...

javascript doesn't execute on window.load

I have a javascript that executes within a element like : <a href="javascript:doSomething();"> but it doesn't execute on window.load , anyone knows why does that happen ? ...

Resources about the Javascript object model?

I am looking for a good resource (comprehensive yet terse) that explains the Javascript object model: prototype, constructor, Function, Object, etc. Surprisingly there aren't many resources out there that discuss this issue. The best I found, so far, is this: http://www.mollypages.org/misc/js.mp Anyone familiar with other (hopefully be...

Trying to use jQuery to display JSON text data

I know very little (none) JavaScript, or much about using API's. However I would like to display some hotel reviews on my webiste made available over the qype.com API. However I'm struggling with being able to manage this. This is the code I have so far: $(document).ready( function() { $.getJSON( "http://api.yelp.com/business_revie...

Why does this JS code fail?

259 function isNumeric(strString) { 260 var strValidChars = "0123456789"; 261 var strChar; 262 var blnResult = true; 263 264 if (strString.length == 0) { 265 return false; 266 } 267 268 // Test strString consists of valid characters listed above 269 for (i = 0; i < strString.length && blnResult == true; i++) 270 { 271 strChar = strStrin...