javascript

Force cache thru header for dynamic generated JS/CSS files not working for all browsers

I have a lot of JS and CSS files for my site. In order to minimize connection requests from browsers, I join them in a single php file. I'm using header parameters to force the files to BE cached. Here is how I do for the JS case (CSS is exactly the same way): <?php ob_start("ob_gzhandler"); $expires= 60 * 60 * 24 * 14; header('Pragma: ...

How to replace last occurrence of characters in a string using javascript

Hi I'm having a problem finding out how to replace the last ', ' in a string with ' and ': Having this string: test1, test2, test3 and I want to end out with: test1, test2 and test3 I'm trying something like this: var dialog = 'test1, test2, test3'; dialog = dialog.replace(new RegExp(', /g').lastIndex, ' and '); but it's not w...

How to move GEvent.callbackArgs over to V3

I have the following code which works under V2 and I am trying to move it over to V3. The issue seems to be the access to the "this" object which holder the polyline to which the event is being added. (there are many such instantiations on the map so I don't necessary know which one is making the call when I receive the event, I can ob...

Why JavaScript returned another page, when i set new window.location?

Hello, all. Have one a question. When i, for example, on "page 1" page, i have js in html: <% if session[:download_link_for_pricing] %> Event.observe(window, 'load', function() { if (confirm("Download new Pricing?")) { location.href = "<%= session[:download_link_for_pricing] %>"; }...

how to bind javascript function with OnClientClick event with Eval?

my link button - <asp:LinkButton runat="server" ID="lbtnEdit" Text="edit" OnClientClick="javascript:msgDisp('<%# Eval(LocationId).toString() %>')" /> and the javascript msgDisp is- <script type="text/javascript" language="javascript"> function msgDisp(lid) { alert(lid); } </script> but it is not giiving ...

Tool for automated validation of web-page against formatting/layout rules?

Hi, Im a UI developer on a financial website and been tasked with finding (or creating) a tool to automate testing pages against a bunch of formatting/layout rules Example rules; use of bracket format for numbers: (123) rather than -123 use of ISO codes for financial amounts: USD 123 rather than $123 all numbers should be right justi...

Setting up AJAX progress bar

Ok im new to AJAX. Kind of know about the lifecycle of a request, IE uses ActiveXObject stuff like that. However now im faced with a real world problem. I have a servlet running in the background that performs a number of tasks and i would like to display a progress bar to show where the process is up to and to also show that something ...

Help with javascript to display cost in label

I'm completely new to javascript and I was wondernig if someone could help me with probably a simple query! I have the following code: http://jsfiddle.net/J47E6/ I've managed to get the hide/show functions to work, but what I'm struggling with is getting the price to display in the label. Can someone point me in the right direction...

Linear Programming with Javascript

Tacking onto this question, I'm told my problem falls into the domain of linear programming. Without addressing how to actually solve the problem (heh), I simply want to know if there are any libraries available for client-side Javascript applications for something like this. ...

javascript pattern replacement using backreference is not working

string.replace(/([\t])/g,"\\$1") is working fine where string.replace(/([\n])/g,"\\$1") is not working!!! any idea please??? N.B. string.replace(/\n/g,"\\n") is also working fine ...

Web performance, inline script questions

can anyone explain on web performance, load external css (combined css) load external javascript (combined javascript) inline css / inline javascript <- will block other resource downloading, recommended to put the javascript before external css how can i put the javascript before external css when i combined the javascript? Is there a ...

How to make custom script into Jquery like plugin

I have writtern a script to limit the number of characters in the textarea, and the code is here <script> function limitchar(charcount, counterId, msgId) { var tex = document.getElementById(msgId).value; var len = tex.length; if(len > charcount) { alert("Content Limit Exceeded"); tex ...

Javascript Scope Problem

Sorry for asking, but how do I access myFunction() from someFunction()? <script> $(document).ready(function() { // Get messages var myFunction = function() { // doSth. } // Make the initial call on page load. myFunction(); ); function someFunction() { // Call the function a second time myFunction(); ...

How to invoke method from codeigniter controller when the page loads?

Hi guys. Can someone please tell me how to invoke a method from the codeigniter controller when the page loads? What I want to do is to fetch some data from database and put it inside meta tags before page actually load. I obviously want to do it inside header. It should be something like this: method, which fetches some data from db an...

Avoiding pollution of globals via iframe script loader?

Problem... Poorly-coded scripts exist which need to be included on a web page. These scripts pollute the global scope by doing things like: Assigning values to undeclared identifiers Adding properties to built-in constructor functions (like Object and Array) and their prototypes Other nasty stuff. Solution? I want to include t...

how to escape special characters within eval using javascript?

var input; // method 1 input = document.getElementById('address').value; alert(input) // method 2 eval('input = "'+document.getElementById('address').value+'"') alert(input) method 1 is working fine, but method 2 is not working when newline characters are inputted and it says "unterminated string literal". I need to store values usi...

jQuery Image Click Help

I'm like 2 hours new to jQuery. I have a list that has usernames and an image next to each username. If they click on the the image next to the username that username will get deleted. Example: <table> <tr><td>MARK</td><td><img src=delete.jpg id=MARK></td></tr> <tr><td>DAVE</td><td><img src=delete.jpg id=DAVE></td></tr> </table> Th...

javascript: get current date/time in seconds?

Hi there, Can anyone inform me of the best way to get the current date/time in seconds in javascript? ...

Does Parent window (The first page of my site) gets focus when closing childs till i return to it?

Hello all, In my system i have a main page, what when clicking on any element on that page a new page is being open, in some cases (button click on child page) from the child page will be open a new page, and so on...when i deside to close any child i need to close all levels to the top and refresh the top level page becouse on the child...

IE 6 JQuery toggle class bug! Help!

While developing a new site I stop periodically and test all new functionality in IE6. It's a pain but we can't drop support yet. I have hit a problem with JQuerys toogleClass function. I have a css styled <button> that toggles between a plus and a minus image when clicked. This works on all browsers expect IE6. $('#searchForm #togg...