javascript

jQuery Accordion and active link

hi, i use the followig accordion menu: function initMenu() { $('#submenu ul').hide(); //$('#submenu ul:first').show(); $('#submenu li a').click( function() { var checkElement = $(this).next(); if((checkElement.is('ul')) && (checkElement.is(':visible'))) { return false; } if((checkElement.is('u...

How to pass value from Javascript to PHP and get return of PHP back to Javascript

Hi All, How to pass value from Javascript to PHP and get return of PHP back to Javascript function I am having HTML page which will have Javascript function which should call PHP (php is another file) for example like function JavaCallphp() { test = Validate.php } "test" is variable on JavaScript Validate.php is the File which con...

Problem accessing global javascript variables

My application has something like the following structure window.object1; window.object2; $(document).ready(function() { window.object1 = new type1object(); }); function type1object() { //lots of code this.property = 'property'; window.object2 = new type2object(); } function type2object() { //lots of code this.proper...

What javascript tools and/or techniques can I use to manage conflict resolution when multiple users are updating shared state within a Google Wave gadget?

I think the answer to this question hinges on the whether or not it's possible to have access to the Operational Transformation architecture directly within the gadget API. It isn't currently there, so what might be the alternatives for fine-grained deltas, as opposed to just a big lock on each variable? ...

Jquery, keypress: my regex is working well, it's messing up my dynamic feedback

/^[a-d][a-d]*(?:_[a-d]+)*$/ I'm using the above regex in jquery where I call it on every keypress on an input field. It works exactly as intended which is a problem because I'm running a dynamic update too. You can tell for yourself what it does, but the point here is the underscore _. It's meant to be followed by a character a-d and t...

Can't get jQuery to return data

I have a very simple jQuery script.. all I want it to do is return the data on the PHP/HTML page but it's not working. The code is below: function sendData() { $.post("validation.php", $("#c_form").serialize(), function(data){}, "html"); } The function is called by an onclick event in the form. I don't get why it is isn't working, v...

Storing arbitrary info in HTML tags for JavaScript?

A very general question. I am dynamically generating a form that is split into multiple levels of tabs using HTML / JavaScript. I want to highlight some of the fields (those that have a value differing from a global template) with a star * symbol using CSS and background-image. A JS field iterates through each field, compares its valu...

JavaScript - Advantages of object literal

I've read that rather than simply writing a bunch of functions, I should use object literal. Can someone explain what the advantages of object literal are with examples, because I don't understand thus far. Thanks ...

why does this javascript array for loop not work like the literal version?

I'm new to javascript and was trying to refactor some code, clearly there's something I'm missing in javascript that I'd like to learn. This code produces a value once all 5 list boxes have something selected: function GetTotal() { //_listSeverity = document.getElementById("_listSeverity"); function ParseListBoxvalue(lis...

Call javascript function from global.asax in asp.net mvc

How to call or make the javascript function from the Application_Start of global.asax in asp.net mvc(C#) application? ...

Passing multiple paramater to PHP from Javascript

Hi All i am trying to Use this function GetXmlHttpObject() { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari return new XMLHttpRequest(); } if (window.ActiveXObject) { // code for IE6, IE5 return new ActiveXObject("Microsoft.XMLHTTP"); } return null; } function CallSomePHP() { xmlhttp=...

Make a new asynchronous call inside a callback function

I would like to use the Google AJAX Feed API to fetch multiple newsfeeds and display them on a webpage. I can't use Google's FeedControl class because I want to control the way the items of the feed are displayed. That leaves me with Google's Feed class as the only option. I've got it to work with a single feed: provide a url and a c...

Javascript to open multiple tabs in single browser

Hi, Does anyone know how to open multiple URL's in a single browser. Instead of opening multiple windows, I want the urls to open in tabs in IE. I am trying to approach this using JavaScript. Thanks in advance. ...

Calling javascript function in iframe

I have problem calling a javascript function in an iframe from the parent page. Here is my two pages: mainPage.html <html> <head> <title>MainPage</title> <script type="text/javascript"> function Reset() { if (document.all.resultFrame) alert("resultFrame found"); else alert("resultFrame NOT f...

creating dynamic Arrays Javascript

Hello i want to create a array in java script withing 2 for loops var i; var a; var total = document.getElementsByName('qm[7]') var creativity = document.getElementsByName('qm[0]'); var design = document.getElementsByName('qm[1]'); var text = document.getElementsByName('qm[3]'); var motivation = document.getE...

Help with calling an internal method of a jQuery plugin

I've written a plugin to highlight terms used to find a page. The source is also available. My problem is, if you look at the first link's inline JavaScript, I've made a custom textPlacement function to handle the insertion of the display bar (it looks a bit like Stack Overflow's). As you can see, I have an event handler on the button ...

using java scripting API to find and destroy bad/malicious java script code

I am working on a servlet (runs on tomcat) which receives requests that contains Java Script code, and using the java scripting API framework evaluates/run the code and returns the answer to the user. Since we are dealing with user generated code, the code can be a good code and it can be bad code. As an example for a bad code can be wh...

Cross-domain if 2 scripts from same domain?

I have a JS file that puts an iframe on every site its on. both the JS and the iframe location comes from the same domain, mine. Can I somehow communicate from within the iframe to the outside script, which isn't running on my domain, but is called from it? I know about JSONP but i'm looking for a better way if possible ...

jquery writing an if

I have some code like this: if ($(event.target).is('.class1') || $(event.target).is('.blab') || $(event.target).is('.foo') || $(event.target).is('.cbncvbn') || $(event.target).is('.dfghdfgh') || $(event.target).is('.tryrty')) { // Do something } Is there a more succinct way to write this? PS: I know there are better ways to do t...

Getting the executed output of an aspx page after a short delay

Hi all, I have an aspx page which has some javascript code like <script> setTimeout("document.write('" + place.address + "');",1); </script> As it is clear from the code it will going to write something on the page after a very short delay of 1 ms. I have created an another page to get the page executed by some query string and g...