javascript

Browser removing + from request parameter

Hello everyone, I'm trying to pass an SQL query string from a Java Applet to Servlet as a parameter. Problem is that in Applet I have something say: sql=select * from p where(+p=1) The resulting sql parameter in the Servlet is sql=select * from p where(+p=1). So anyone knows how to prevent the browser from removing the + character ...

Is my javascript coding style following best-practice?

What is the 'best practise' with regard to coding style. Should I use _ for private members? Should I use this._privateMember? Please re-write my code in proper style if its wrong: (function()){ var _blah = 1; someFunction = function() { alert(_blah); }; someOtherFunction = function { someFunction(); } }...

JavaScript: How to download JS asynchronously?

On my web site, I'm trying to accomplishes the fastest page load as possible. I've noticed that it appears my JavaScript are not loading asynchronously. Picture linked below. How my web site works is that it needs to load two external JavaScript files: Google Maps v3 JavaScript, and JQuery JavaScript Then, I have inline JavaScrip...

How to create public and private members?

I'm a bit confused, how can I create public and private members. My code template so far is like: (function()){ var _blah = 1; someFunction = function() { alert(_blah); }; someOtherFunction = function() { someFunction(); } }(); ...

Is there a Javascript library for editing PDFs?

Based on my Google and stackoverflow search I'm guessing no, but it can't hurt to ask. The goal is: store some blank forms on my server. Then present these to the user, who edits the form in the browser with Javascript and submits the form back to the server. The client wants to reuse parts of an old system (the forms) in which users w...

JavaScript for loop index strangeness

I'm relatively new to JS so this may be a common problem, but I noticed something strange when dealing with for loops and the onclick function. I was able to replicate the problem with this code: <html> <head> <script type="text/javascript"> window.onload = function () { var buttons = document.getElementsByTagName('a'); for (v...

How do I put a clear button inside my HTML text input box like the iPhone does?

I want to have a nice little icon that, when clicked will clear the text in the <INPUT> box. This is to save space rather than having a clear link outside of the input box. My CSS skills are weak... Here is a screenshot photo of how the iPhone looks. ...

How do I get from JS array through JSON to a PHP array? (I'm at least halfway there)

I have a JS array, which I convert to JSON JS mycode[0][0]=true mycode[0][1]="element1" mycode[0][2]=400 mycode[0][3]=150 mycode[0][4]=148 mycode[0][5]=148 turned into JSON: [ [ true, "element1", 400, 150, 148, 148 ] ] Now I push this to PHP PHP code: $decoded = jso...

How to force a page refresh or reload in jQuery?

The code below displays a google map and search results when you enter an address and hit the submit button. I've been playing with it to try and force the page to completely refresh or reload once you hit the submit button. But I can't get it to work right. It loads the results "in page," but I'd like the page to completely refresh w...

Javascript does not work on IIS

I have a .NET library executing as part of our website that renders HTML to image formats. It uses the IE rendering engine, and will happily run any javascript if present to do the rendering. To clarify. The code is rendering the HTML onto the server. No client is involved. The problem is we just moved the code to a new server, a...

Get & set drop down value using jQuery.

If user select an option from dropdown it will shown it a textbox but if he select option having value "Other" then a row will appear to type value for other. my code works fine except when option value is not equal to "Other" <script type="text/javascript"><!-- function setAndReset(box) { if(box.value == 'Other'){ $("#ShowHide").h...

GWT : User Location

In GWT, is there a way to find out the user's physical location (country, state etc)? ...

Checking for attachments in JavaScript

Prior to submitting a form, I would like to check if a file has been attached and pop up a warning message saying that a file needs to be attached if it hasn't been. I was wondering how to accomplish this using JavaScript or Prototype or JQuery etc? ...

Is this a good decorator pattern for javascript?

I need some simple objects that could become more complex later, with many different properties, so i thought to decorator pattern. I made this looking at Crockford's power constructor and object augmentation: //add property to object Object.prototype.addProperty = function(name, func){ for(propertyName in this){ if(property...

JavaScript String Library - Hitting a Minor Roadblock

Ok - am trying to create a string library that contains a handful of useful things missing from JavaScript. Here is what I have so far: function $__STRING__$(in_string) { this.s = in_string; } $__STRING__$.prototype = { uppercase: function(){this.s = this.s.toUpperCase(); return this;}, lowercase: function(){this.s = t...

Dynamic script addition should be ordered?

Hi, I'm adding some <script> tags dynamically to the head element after page load. I understand the scripts are loaded asynchronously, but can I expect them to be parsed in the order they are added? I'm seeing the expected behaviour in Firefox, but not in Safari or Chrome. Looking at the document in Chrome developer tools and Firebug, ...

Multiple Regex on String

How can I apply multiple regexs to a single string? For instance, a user inputs the following into a text area: red bird blue cat black dog and I want to replace each carriage return with a comma and each space with an underscore so the final string reads as red_bird,blue_cat,black_dog. I've tried variations in syntax along the line...

ASP.NET over menu

How to open menu when mouse is over the image? Where can I find a tutorial, source, etc.? ...

show/hide a link if certain jquery ui tab is selected.

When #my-text-link is clicked, i need to select tab 5 and when tab 5 is selected i need to hide #my-text-link. hope this makes sense, heres the code, and also what I have done so far, please feel free to show me a better way. Thanks in advance var $tabs = $('.tabbed').tabs(); // first tab selected $('#my-text-link').click(fu...

javascript function wont fire in IE...

I have this code: <body onLoad="subcatSelection();"> The function is inside a .js file which is included with this code: <script type="text/javascript" src="bincgi/search_lists.js"></script> The function contains an alert('hello'); just for testing purposes to see if it gets called, but it doesn't. The "Page error" or whatever...