javascript

HTML not updating?

I have a CGI application written in C. When I POST (delete data) to the cgi app from the html form, the action is correctly executed on the server but the page does not refresh after the POST. It does flicker, but displays the non-updated page. I then have to hit the browsers refresh to see the correct updated html page (showing data has...

Creating an object in javascript pointing to a table row with an "id"

I'm having trouble finding information online for creating a object in javascript and pointing it to a id in the html. Here's what I have so far for the JavaScript: function countRecords() { headRow=new Object(); //point to specific id here? var rowCount = 0; The HTML: <table id="prodTable"> <tr><th colspan="8">Digital Camer...

How do you automatically refresh part of a page automatically using AJAX?

$messages = $db->query("SELECT * FROM chatmessages ORDER BY datetime DESC, displayorderid DESC LIMIT 0,10"); while($message = $db->fetch_array($messages)) { $oldmessages[] = $message['message']; } $oldmessages = array_reverse($oldmessages); ?> <div id="chat"> <?php for ($count = 0; $count < 9; $count++) { echo $oldmessages[$count...

jquery .load not applying ready function

On document ready I run this code: jQuery(document).ready(function(){ jQuery('#button').click(function() { jQuery('#contact_form').load("/Users/mge/Downloads/jquery-ajax-1/readme.txt"); return false; }); }); Then if I create a form like <div id="contact_form"> <form name="contact" met...

How do I get the index of an item in an array?

var fruits = [ 'apple', 'banana', 'orange' ]; how do I find what index of the value "banana" is? (which, of course, is "1"). thanks ...

How to check for empty values on two fields then prompt user of error using javascript

Hello guys, I hope I can explain this right I have two input fields that require a price to be entered into them in order for donation to go through and submit. The problem that I am having is that I would like the validation process check to see if one of the two fields has a value if so then proceed to submit. If both fields are empt...

Code Completion -- Aptana Eclipse Plugin

I have been doing javascript development for the last couple weeks and have tried JSDT and Aptana to assist in code completion. JSDT wasn't very good at all, but I did have more luck with Aptana (used as eclipse plug-in, not the standalone product). The problem I'm encountering is that when I create javascript classes I cannot get code...

Chat client with GWT

What would be the best way to create a JS chat client with GWT? The bit that I'm having trouble with is the persistence and transfer of the messages. Should I store the messages in a DB and check the db for new messages? Is there a much better way to do this? ...

Is it possible to load an external JavaScript file by flash and then call its methods

I am talking about doing something like this: http://stackoverflow.com/questions/1375714/load-external-javascript-on-function-call from flash by using ExternalInterface probably ...

Custom GridView delete button

How can I customize automatically generated command button, e.g. Delete? I want to add a client confirmation on deleting and in the same moment I want this button would be generated on setting AutoGenerateDeleteButton="true". Is it possible?? I can add a custom button this way: <asp:TemplateField> <ItemTemplate> <asp:LinkB...

Passing Variable in load

I have a load action tied to the submit button of a form. jQuery('#content').load("/control/ajxdata/installs.php?country=" + country); jQuery('#content').load("/control/ajxdata/installs.php",{ 'country': country }); The name, and the id of the form element I am trying to utilize is "country" In the error console, I am getting "E...

Simply tag-based highlighting with Javascript

Hello, I got this code which works: <html> <head> <title>JS highlighting test</title> <script type="text/javascript"> function highlight() { var t = document.getElementById('highlight').innerHTML; t = t.replace(/(if|switch|for|while)\s*(\()/gi, "<b>$1</b>$2"); document.ge...

When does IE7 recompute styles? Doesn't work reliably when a class is added to the body.

I have an interesting problem here. I'm using a class on the element as a switch to drive a fair amount of layout behavior on my site. If the class is applied, certain things happen, and if the class isn't applied, they don't happen. Javascript is used to apply and remove the class. The relevant CSS is roughly like this: .rightSide { ...

Accessing function defined in a SWF object from javascript requires a time delay

Hi, Is there a way to avoid the time delay required to access the functions defined inside a SWF object after dynamically adding the object to the DOM. for example, 1) I'm using swfobject.js api to add swf object dynamically add the SWF object to the DOM. var oSWF = new SWFObject("SWF Object path reference","SWF object ID", "100%","7...

How do you use asynchronous ORMs without huge callback chains?

I'm using the relatively immature Joose Javascript ORM plugin (project page) to persist objects in an Appcelerator Titanium (company page) mobile project. Since it's client side storage, the application has to check to see if the database is initialized before starting up the ORM since it inspects the DB tables to construct the classes. ...

Using // in a <script>'s source

Hello fellow front-end web h4X0|2s, I was wondering if anyone had any resources, proof, or personal experience in using the age-old http/https JavaScript hack: <script src="//someserver.com/js/script.js"></script> Has anyone encountered issues in any of these browsers (IE 5.5+, FF2+, Chrome, Opera 9+, Safari 3+)? Has anybody had su...

What does "!" mean in pseudo-code? I know "!" stands for factorial but I can't translate it

What does ! mean in pseudo-code? I know ! stands for factorial but I can't translate it . ex: get operation if (operation!= ’B’ OR operation != ’D’ OR operation!= ’W’) then print "Invalid Operation" What does it mean? Please help my mid-term is in hours :S Thanks in advance for your help :) ...

Regex to remove multi line comments

I am trying to use this regex (JS): /\/\*(.*)\*\//g To replace /* sdandsads */ with nothing. But it is not working! Why? o_O ...

jquery to construct a string and pass it as a post argument for file

I have this js code: $("#startSearch").live("click", function(event) { $("input:checkbox[name='searchId']:checked").each(function() { var searchId = $(this).val(); var host = ''; $.post("php/autosearch-get-host.php",{sId: searchId},function(data){ host = 'http://' + data + '/index.php'; })...

jQuery UI: Drag and clone from original div, but keep clones

I have a div, which has jQuery UI Draggable applied. What I want to do, is click and drag that, and create a clone that is kept in the dom and not removed when dropped. Think of a deck of cards, my box element is the deck, and I want to pull cards/divs off that deck and have them laying around my page, but they would be clones of the ...