javascript

how to make javascript functions together?

Hi Below is the JavaScript code I use in my HTML page <script type="text/javascript"> function loadXMLDoc(HTTP) { var xmlHttp; try { xmlHttp=new XMLHttpRequest(); } catch (e) { try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { ...

how to get my while loop to work?

Hi, I have a programme in which I have written three functions, difference (that calculates the difference in numbers between arrays) sum (that totals the array up) and calculate difference which uses the difference function to determine what the next array should be). All these functions are working but I'm having problems getting the...

countdown in javascript

I have got a piece of code, that should countdown some number (in this example 1111) and write it into span id="timeframe". But it doesn't work, i dont know why. Can you tell me where is my mistake, please? <script language="JavaScript"> <!-- var txt_minute = "Min"; var txt_second = "s"; var time_left = 1111; var temp=timel...

CSS/Javascript: dynamic multiple columns

hi, I need to build a dynamic multiple columns view for the content of my website (I'm using drupal as CMS, if can be useful info), with the following features 1) the columns width is fixed (OK) 2) the columns number depends on the window width (OK) 3) the elements has not fixed height (important, not fixed yet) 4) the content shoul...

javascript - replace character at specific position in textarea

Hi, is it posible to replace a character at a specific position within a textarea or textbox? I can work out the position using indexOf() but knowing this how can i actually replace that particular character? ...

Prevent Firefox autocompletion from popping up

Hi. I wrote an autocompletion script for an input field on a website. It uses jQuery and works fine. It should look something like this: Unfortunately, Firefox's own autocompletion gets in my way, overlapping some of the results: Is is it possible to prevent the Firefox autocompletion field from popping up? (Not only on my machine ...

Javascript synchronous AJAX timeout

My Javascript needs to send some data to a server when the page closes, which I currently do with a synchronous AJAX (SJAX?) request in window.onbeforeunload. The problem with this, of course, is that if my server takes too long or the network connection dies, the browser freezes. From what I've read, it's not possible to specify a time...

Make long log data diplayed with PHP easy to read

I have a long log file I am displaying with PHP. Its getting too long for me and I have to use CTRL+F to look at this thing in any way. What is a good way to display this data in a way easy to read? Best way would be using jquery. ...

AJAX and JavaScript

Im having an issue with the request below, for some reason I can seem to get the XML to display? I've checked the URL and it displays fine, so im wondering whats going on?! Could anyone give me a hand? There should be something in the ResponseText not "NULL". var url = "https://services.lexel.co.uk/paf/"; loadXMLDoc(url) function lo...

Paperclip and xhr.sendAsBinary

Hi, I use paperclip to add a file to my model. I want to use the new feature of firefox 3.6, xhr.sendAsBinary, to send a file with an ajax request. Here is how I build my request : var xhr = new XMLHttpRequest(); xhr.open("POST", "/photos?authenticity_token=" + token + "&photo[name]=" + img.name ...

Sharethis Customization

I imagine its a bit of javascript but how do you have the ShareThis widget go straight to the email page like on Mashable? ...

How do I use alert() for a long debug message?

I'm trying to alert() the properties of the javascript object. Since the text in alert isn't scrollable, I can see only part of it. How do I fix this? I'm using FF 3.5. ...

How to use jQuery to add a new row to a table, and assgin an incrementing id to it

Hi All, I have an existing HTML table, part of a form where the user enters GPS points. The user also has the option to upload GPS data points. I'd like to have a button the user can press where some Javascript will add one or more new rows to the table, but the new row(s) must continue incrementing the name and id values used in the ...

Alternative to the "switch" Statement

Hi all, I do not want to use Switch in my code, so I'm looking for some alternative Example with Switch: function write(what) { switch(what) { case 'Blue': alert ('Blue'); break; ... case 'Red': alert ('Red'); break; } } Example without Switch: colors = []; colors['Blue'] = function() { al...

Switching menu items between two lists using buttons in JavaScript

I have this school assignment that I've been working on and am totally stumped as to why it's doing what it's doing. Basically it's a left selection list, 2 middle buttons, and a right selection list. The purpose is to move options between lists. My problem is as follows: a selection is made on left list, the move to right list button is...

What is the proper way to format a JavaScript tag?

Having developed web apps since 1996 I often find new ways of doing old things. So I was wondering what is the proper JavaScript tag to use on new development? Currently I use something like this for XHTML <script type="text/javascript"> /* <![CDATA[ */ /* ]]> */ </script> I have read somewhere that this may cause problem with olde...

Can I use Google Analytics to track usage of a Greasemonkey script?

I've got a greasemonkey script and I'd like to get an idea of how many regular users I have, what I'd really like is to use Google analytics inside the script. But I'm not sure how to do it if it's even posible. Also, the site the GM script is running on also has Analytics so would this clash prevent me from doing it? ...

Domplate system in Firebug - how to use 'insertRow' method?

how to use "insertRow" method from domplate template system to insert data to table? i cant get this to work.. ...

Jquery Dialog..What am I doing wrong?

I am not sure what I am doing wrong. The dialog box comes but it does not follow any of the settings I specified. function voteToday(id,userid){ $(".pleaseLogin").dialog({ autoOpen:false, bgiframe: true, resizable: false, width:200, height:75, modal: true, overlay: { backgroundColor: '#000', ...

It is possible to include Php variables or URL in Javascript in an If-statement?

I want to make some thing like this my-php-file.php $lang = 'es'; my-js-file.js if ($lang == es) { something-magical-happens; } or like this: if (URL == www.mydomain.com/index.php?lang=es) { something-magical-happens; } ...