javascript

Is it better to use divs or tables to contain columns of links?

I have a page with 3 columns of links at the bottom. Each column is put into a div and all three divs are wrapped into a big div that is centered on the page. Is this something that is better suited to a table or is a table the wrong element for the job? ...

Javascript: hiding prototype methods in for loop ?

So lets say I've added some prototype methods to the Array class: Array.prototype.containsKey = function(obj) { for(var key in this) if (key == obj) return true; return false; } Array.prototype.containsValue = function(obj) { for(var key in this) if (this[key] == obj) return true; return false; } t...

jquery tabindex/focus & hotkeys

There seem to be some problems with tabindex in several browsers so I want to work around these issues using javascript/jquery. Specifically FF3.5 (Mac) doesn't accept tabindex or focus on links at all. I have jquery 1.3.2 and js-hotkeys 0.7.9 running on my website. I have 4 forms on 1 page which I can switch between using a link. Now ...

Retrieving Field Value from Form Input Generated Dynamatically

I am not sure whether this only happens to me. Basically if I have a new element added to the page using YUI var element = new YAHOO.util.Element(document.createElement('input')); element.set('value', 'some value'); element.appendTo(document.body); Then I read the value of the element using these different ways, and get consistent res...

How to remove digits and text from the end of a string in Javascript

Hi, I need to remove the following format from the end of a string in javascript 1234, Australia And only at the end of a string. How would I do this? ...

hide a div

Hi everybody, I am designing a web page in which i got struck at some point. i am using 3 upload buttons in a div, let the id of the div be "uploadDiv" i have a right arrow and down arrow images if i click on the down arrow image, the content of the "uploadDiv" should be displayed if i click on the right arrow image, the content of the...

hidden field value lost after postback.

Hi, I have two hidden controls: <asp:HiddenField runat="server" id="pageHeader" /> <asp:HiddenField runat="server" id="pageInformation" /> I am calling following function from master page: show_tip(this, document.getElementById('ctl00_pageInformation').value, document.getElementById('ctl00_pageHeader').value); and i am passing val...

Page Entirely Blank Despite Having Source Code! (TinyMCE, FireFox)

Alright guys, here's a tough one... In reference to this page. The page will seemingly randomly not display the output of server when using Firefox (version 3.5). I have not seen this problem occur in Safari or IE. The best way to have the problem occur is just reload the page about 10 times and it ought to have happened by then, and...

Non-blocking Javascript

Hello, I am wondering if it is possible to load javascript in a way in which it does not block the user experience. I am not sure how to achieve the same, but I am looking for a cross-browser solution. I am wondering if someone can guide me in the right direction. Placing the js at the bottom of the page does not work too well. Thank y...

return javascript code full of 's, "s and \s from within a class, how can I do it?

I have a very long javascript (so long that it's too long to escape manually every single problematic character) that I need to return from a method inside a class. Are there way to return (return not echo or print) safely this kind of code? Thank you very much ...

Javascript framework

which javascript framework can be used for all browsers ...

Text box content rendering in a new window using javascript

I have a asp.net textbox(textarea which is in a repeater have single texarea for each record which are read only) I have button (open in new window) when i click on it the content of the text area needs to be rendered in a new window using javascript . similar to experts exchange. ...

Regexp to match Javascript string literals with a specific keyword using Java

I'm trying to match chunks of JS code and extract string literals that contain a given keyword using Java. After trying to come up with my own regexp to do this, I ended up modifying this generalized string-literal matching regexp (Pattern.COMMENTS used when building the patterns in Java): (["']) (?:\\?+.)*? \1 to the following ([...

Definitive reference for Google Maps Placemark object

I am using the following method to reverse geocode a google maps latlng: [GClientGeocoder.getLocations(address:String, callback:function)][1] Which states as follows: As this method requires a call to a Google server, you must also pass a callback method to handle the response. This response will contain a Status code, and if succes...

Which testing-framework for Javascript supports Testing without a browser?

For Javascript some testing-frameworks exist, like JSUnit or js-test-driver. They are fine, but they run the tests in a browser. That's fine, especially to verify your webapp is running in different browsers. But on out continuous-integration-server no window-system (and no browser) is installed. So is there a way to run the tests withou...

Splitting a floated DIV in 2 if it's going to drop down a row

Say I have a wrapper DIV and, for example, the DIV is 600px wide. Inside this div I left-float a series of content DIVs. These are either 200px or 400px wide, all have the same height. Three 200px-wide DIVs would align perfectly one one line, a single 400px one followed by a 200px one also, etc. Obviously if I had two 200px ones, foll...

Applying tags through Regex to spcefic characters of a string given an array with includes the numbers

I'm progamming in javascript/jQuery. Say, I have an array with includes a few number [1, 4, 5] and a string "theword". I want to turn that string into "t<b>h</b>ew<b>or</b>d". What is the best way to do this with RegEx? ...

Optimal Way to Pass C# Variables to JS

I have several functions that are written in JS that do error checking on my site. On one instance I want to disable two of the checks if a certain instance in the DB is true. I have something like this on the aspx.cs if (this.exemptcheck == true) { // could set a variable to pass or whatever is optimal here } Then in JS I have ...

TabView and close button problem

I try to do the same thing as Davs Rants Example : http://blog.davglass.com/files/yui/tab3/ But I must forget something... I have this error : Node was not found" code: "8 [Break on this error] this._tabParent.removeChild( tab.get(ELEMENT) ); Here my code : function onGenePubmedSubmit() { var contentCur = document.getElem...

How to make a login frame display in the center of the window when the button is clicked?

Just like what happens when you click Sign in with OpenID on http://twitterfeed.com/, I want my login frame displays in the center of the window, and only when some link is clicked. But now I have difficult to center a div, I have written CSS as following but it doesn't work #logindiv { position: relative; overflow: auto; m...