javascript

JavaScript code improvement

I am not a huge JavaScript performance guru. Simply wondering, can I make the following code anymore compact? Not as in packing or compressing it, but in the way it's written. (function() { var jq = document.createElement('script'); var an = document.createElement('script'); var cm = document.createElement('script'); var...

jQuery slideDown / slideUp not working in IE7

So I'm using a very basic jQuery .slideDown which is working great in FF, Safari, and Chrome. Won't work at all in IE7. here is the script: //Top Mailing List Drop down animation $(document).ready(function() { $('div#top_mailing_hidden').hide(); // Expand Panel $("input#top_mailing").focus(function(){ $("div#top_mailing_hidden").sl...

Quickest way to pass data to a popup window I created using window.open()?

I have javascript code to open a popup window using the window.open() function. I'd like to pass data from the parent window to that popup window and I can't seem to find an elegant or simple solution anywhere on google or SO, but it seems like there should be support for this built into JS. What's the easiest way to pass data to the p...

Does Linq Exist for Javascript?

Just wanted to know if I can use Linq on Javascript arrays. If not is their a 3rd party tool I can use? ...

jQuery - make global variable available to multiple plugins

I have a set of jQuery plugins I'm creating for a website. All of these plugin have the common functionality that they make $.getJSON() calls. The URL passed in these calls varies based on Dev, QA and production environments. I would like to store the URL in a central place so it can be easily changed. Where should the URL be stored?...

How to call a servlet from a jQuery's $.ajax() function

I am trying to call a servlet from jQuery's .ajax() function. At the moment I don't think I am even calling the servlet or passing paramaters to it, however lots of Googling doesn't seem to have helped. Any ideas? This is my html: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <script type="text...

How to validate digits (including floats) in javascript

Currently i'm using this reg exp: var valid = (value.match(/^\d+$/)); But for digits like '0.40', or '2.43' this doesn't work. How can I change that reg exp above to match floats as well? ...

Restricting a user to enter more than 7 digits before decimel and 3 after decimel

Hi, I want to get a user input from user in a textbox, but i need to validate it 1.It should not take more than 7 digits before decimel 2.it should not take more than 3 digits after decimel I actually figured out the 2nd part,,but first part is still a problem my regular expression is: /^([0-9]{0,7})+(\.[0-9]{1,3})?$/ Tell me whe...

ReplaceAll function in javascript

Hi all, I am getting a string "test+test1+asd.txt" and i want to convert it into "test test1 asd.txt" I am trying to use function str = str.replace("/+/g"," "); but this is not working regards, hemant ...

Suckerfish dropdown omitted in IE7

Using suckerfish dropdown here: http://tilwellpetroleum.com/ Client is not seeing the dropdowns (hover over "About Us") in IE7 Vista. I am not able to reproduce the issue on my end. I know CSS pretty well but I am stumped. any advice? ...

Help with Shadowbox

Hey guys, I'm trying to get Shadowbox to work. Whenever I click the link, it just opens the movie in a new page. Here's the code in the head tags: <script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"&gt;&lt;/script&gt; <link rel="stylesheet" type="text/css" href="shadowbox.css"> <script type="text/javascrip...

SO rep JSON not working

I'm writing a Google Chrome extension for users to monitor their Stack Overflow account and notify them of new reputation, but I'm having problems with the JSON request to access the rep data. I'm using JQuery as my JSON library. Using the address: http://stackoverflow.com/users/rep/{userid}/{from-time}/{to-time} where the times are in ...

where can I learn about how do developer browser bookmarklets (language, framework, IDE, techniques etc)?

Hi, where can I learn about how do developer browser bookmarklets (language, framework, IDE, techniques etc)? Perhaps they are more of a Javascript development thing? To give examples of what I'm talking about see: http://www.evernote.com/about/download/web_clipper.php and http://readitlaterlist.com/bookmarklets/ Thanks ...

Getting cell value from table in jQuery

I have a table with no id or name inside of a div. How do I read the value from the desired table cell in jQuery? For example: <div id="myDiv" style="padding-top: 0px; height: 60px;"> <table width="264" cellspacing="0" cellpadding="0" border="0"> <tbody> <tr> <td width="80" height="20" style="font-size: 10px;"> </td> <td id="the...

How to center a Div across all Monitors/Resolutions/Browsers?

Hello All, I have created my own light box, the problem is that it shows centered on my monitor but not on wider monitors or bigger resolutions. What is the best way to center a div across all resolutions/monitors/browers? ...

how to render a .htm page into .aspx page

i have aspx page which has to render .htm page how can it be done if possible then i want added feature that is i want to call a JavaScript after that .htm page is rendered pls help ...

disableing enter/return key from within Tiny MCE

Hi I've tried a numerous amounts of "googled" snippets for disabling enter / return key but nothing is working. Any ideas on how to disable the enter / return key whilst in tinyMCE textarea? ...

OnClientClick="return confirm('Are you sure you want delete');"

hi this is the code i am using for confirmation but when clcik on link button it ask me confirmation during the first time if i give ok record is not getting deleted[ only for the first time] after that records are getting deleted successfully <asp:LinkButton ID="LinkBtnDelete" runat="server" OnClientClick="return confirm('Are y...

Please help to understand a snippet of JS

It's http://kan.pps.tv/web/pps.js PPStream.prototype.pps_width="400px"; The PPStream is never declared, is this PPStream object purely generated by 'prototype' way? I know how 'prototype property' works. Thanks. ...

JavaScript: Variable Value gets lost between functions

I have the following code function updateSliderContent(json) { //<- json defined here is correct var screen_order = json.screen_order.split('_'); jQuery.each(screen_order, function(i, item) { var screen_id = item; //at this point it is not, thus the function does not execute whatever is in the if blocks if (json...