javascript

Show and Hide div's javascript works in IE but not FF or Chrome

I have a number of spans(20 - to be exact) they all have Id's. I then in my style sheet I set the visibility to hidden. I made this script to show and hide these spans once clicking on a section of the image map: function showDiv(pass) { var divs = document.getElementsByTagName('span'); for (i = 0; i < divs.length; i++) {...

How to remove script tags?

On my website I have tags that people can use to post on my site and mess with it. What I would like to know is how do i make it so the browser just reviews everything in a file I write too as text. I would like it so there is no html and in certian parts of my website! All of it is in ASP ...

Trying to access JSON menu in another function to build out a left side navigation

Hi All. I am relatively new to Jquery and JSON and this is my first post here, please bear with me. I have a JSON menu string with an array of three items (name, url, id - our internal page id number) and the top level navigation builds out fine. I loop through the top level items and call a recursive function to get the sub menus. ...

JavaScript Regex (string should include only alpha, space, hyphen)

I'm trying to create a regex that will match only when the string has anything but alphas, spaces, and hyphens. In other words, the string can only contain letters, spaces, and hyphens. ...

Can this function be made faster? Javascript

I have a function that gets an array of DOM elements (based on tags) within a div. Pseudocode: 1. Say I wanted to get all input and textarea elements within a table myTbl 2. Declare resultingArray = null 3. For each tag (ex: input, textarea) 4. tagArray = Get all elements based on tag 5. Create another array by manually looping thro...

Why Javascript Codes Don't Run in user control ?

I'm working on a project that contains a single page (home.aspx). Home.aspx contains a ScriptManager and an UpdatePanel a div with some LinkButtons that load related UserControls. Some of those user controls contains javascript. My problem is that the javascript doesn't run on time (after LinkButton click or UC loads). How do I solv...

Is passing multiple sets of arguments as an array in JavaScript faster than multiple function calls?

After becoming slightly uncomfortable with multiple calls to the same function, with different parameters (as shown in the dom ready section of the code below), I decided to test out passing the parameters for this function by iterating through an array instead (as shown in mouse_function_two). To my surprise I found that mouse_function_...

How to pass variable from grid to new page without loading the first grid again

I have a page that loads data into a grid. When the user selects one of the rows of the grid, I need to send them to another page and open that second page based upon the ID selected in the first page. Currently, I'm posting back to the first page, building the grid, getting the ID from the row, stuffing it in session, then response.red...

Concantenating CSS and JS prior to compressing? Tools? Best Practices?

I'm working on a one-page site that is incorporating about a dozen .js files and and maybe a half dozen .css files. Most of the .js files are jQuery plugins. Aside from a base css file, the CSS files are for the corresponding jQuery plugins. YUI Compressor seems to be a favorite for compressing CSS and JS files. However, it only compre...

how to make Javascript shortcut in all browser.

I'm trying to make shortcut with javascript. It works with FF but not with IE8. I'm using this code - document.onkeydown=function(e) { if(e.which == 83) { alert("hello"); } } Please give me a simple code which will support all browsers. Thanks ...

Programmatically Created AccordionContainer in a BorderContainer having sizing issues.

Hi all, I am trying to programmatically create an AccordionContainer within a BorderContainer. I am able to get the accordion container to show up, however, it appears that it incorrectly computes it's initial size. When the screen draws, the second accordion panel is off the bottom of the screen. If you resize the screen, or press the ...

dojotoolkit help

i am new to dojo actually i have three divs and div no1. have 10 pictures and other two divs are empty. i want user can drag pictures to any div (2,3) or drag back to div1 in last i want to store in db using php. can any body help me.? ...

Converting "document.getElementById" into jQuery.

I've been thinking/searching for an equivalent of the problem that I am having below, and nothing could be found. Is there a way I can rewrite this to work with jQuery as an alternative? First half of the code. <a href="link.php?test=true" onclick="request(this)" target="_blank"> <a id="step2" href="javascript:alert('NOT FINISHED!');...

Changing the value of "id=" with document.getElementById

Is this the correct way to do it? <a id="load" href="#" class="btn load" onclick="request(this); $('#load').fadeOut(2000)">add</a> <a href="#" id="test" onClick="alert( 'TEST!' )">here</a> <script language="javascript"> var requests = 2; function request(self) {if(self.href != "#") requests -= 1; if(requests === 0) document.getEleme...

javascript closure immediate evaluation

Hi, Consider the following Javascript code: var a = []; var f = function() { for (var i = 0; i < 3; i++) { a.push(function(){alert(i)}); } for (var j = 0; j < 3; j++) { a[j](); } }; The alerts print out '3' all three times. I want a different behaviour - in each iteration of the loop generate a funct...

Static Google Maps Custom Icons

I've been looking for a way to add custom markers to a static Google map. I know the API doesn't provide the functionality, but I was wondering if there are any third party scripts that would do this. If not, how would I place my custom transparent images onto the static map? Thanks ...

Getting a DIV to auto load with jQuery.

I've scratched my previous attempts at changing an ID attribute. Is there a way I can make the content below auto load if the requests === 0? Rather than having a click function. <script language="javascript"> var requests = 10; function request(self) {if(self.href != "#") requests -= 1; if(requests === 0) var pageid = function () { ...

Delimiting four nested items in Javascript/Html

Okay this is frustrating me to no end. I recently coded a page in JS for a buddy of mine who wants to display wedding pictures to a family to see which ones they'd like to purchase. I used a for loop to count 1-904: for (beginnum=1;beginnum<=904;beginnum++) { yada yada... Then, I used adobe bridge to rename the camera files to be 1-9...

jQuery Replace Strings With URLs

On my site I have a few strings which look something like this (Could be any numbers) 29-30-404-59556348 Using jQuery I want to parse this into <a href="http://www.mysite.com/page.php?=29,30,404,59556348"&gt;Page&lt;/a&gt; How would I do this? ...

Create fireflies in Javascript?

I want to create some randomly flying objects in a 3D game. You can imagine them like fireflies. Now there're some tasks to do with them, include: They usually fly randomly (of course). They can fly away or fly back in some conditions. I have to write some Javascript to do these things, but I don't know how to do. Can you help me? Th...