javascript

How to step through code in Google chrome javascript debugger

hi guys, i am really getting frustrated with google chrome... i have version 3.0.195.27 and want to debug some javascript that is working in IE ,FF but not in chrome when i open the debugger and mark breakpoints(the blue arrow thingy) and execute the javascript it hits the breakpoint and then i do not know how to step through code....i...

How to Maintain a persistent state of the drop down?

Hi All, I am making a simple web app that has drop down list in the first page in a form tags. Now wen I change the value in the dropdown the form is submitted. On the onchange I have made call to create a query string custom JS function of the selected Index. Now I want the drop down list to maintain its state; keep the last selected va...

require javascript confirmation like alert()

Is there anyway to create an alert box, but with a more modern style? When an alert box is issued, the user can not use the browser until it is acknowledged (enter key or click OK). I would like to lock the browser in the same fashion, however use a custom made, better looking alert box. Is this possible with javascript? Thanks Edit: T...

Make IE respect your whitespace with dynmically changed content

If I have the following line in html: <span></span> wtf and then I run the jQuery statement: $("span").html("test"); It ends up looking like "testwtf" instead of "test wtf". Is there anything I can do about this without changing the html? ...

Parse date string in JavaScript

Does anyone know how to parse date string in required format (dd.mm.yyyy)? ...

detect tab characters with javascript in IE

I want to detect and replace tab characters in a bit of HTML like this: <code> something { something else } </code Right now, I am using something like this: $(this).html(replaceAll(trim($(this).html()), "\t", "&nbsp;&nbsp;&nbsp;")); But IE, in all its cleverness, changes tab characters into spaces, and so doing the above ...

How to use AJAX in DRUPAL

I want to implement AJAX in DRUPAL 4.7 as I am beginner in Drupal can any one help me in this, it would be great if I get a snippet of Code. Actually in a page I have list of items is being there using pagination it is being accessed, but everytime when I click on the next button it relaods the page, Since in the same page I have other ...

How to organize a Javascript UI?

I need good examples and best practices on program architecture. I'm trying to build a JS UI for an app that works with Google.Maps. In the 1st draft, user should be able to draw geometric shapes on the map in a way similar to G.M. Then the shapes are sent through AJAX and the response is displayed. Problem is that the code got complic...

Forcing Scripts on Links

So I am trying to force every link on my blog to run a script, that show's the title in a css'able bubble rather than the standard yellow box, without having to insert the onmouseover="tooltip.show('title value here');" onmouseout="tooltip.hide();" in every <a> that it requires me to. I really have no clue about Javascript or how t...

Using Array class in parent and child windows (javascript question)

Hi, I'm actually coding a case where a child popup window transfer data to parent window as: var childArrayData = new Array(); childArrayData[0] = 'Data text1'; childArrayData[1] = 'Data text2'; childArrayData[2] = 'Data text3'; window.opener.parentVariable = childArrayData; I got an error which was solved like: var childArrayData =...

Can !important rules be used in IE's CSS expressions?

Firstly, I know that CSS expressions are defunct and wrong in so many ways, and also to avoid using !important where possible. This is for a special case stylesheet. In Short My question is... Is there any way for a CSS expression to set the !important flag? E.g. this doesn't work: a { color:expression('red !important'); } [Edit: t...

'Sys' is undefined javascript error

I am getting the following error: Microsoft JScript runtime error: 'Sys' is undefined While trying to execute: <head id="Head1" runat="server"> <title>Untitled Page</title> <script language="javascript" type="text/javascript"> //ERROR IN THIS LINE!!! Sys.WebForms.PageRequestManager.getInstance().add_endR...

Instrumenting Javascript

I would like to instrument Javascript code in order to "log" values of global variables. For example I would like to know all the values a particular variables foo had during execution. The logging is not the problem. Do any of you know what would be the easiest way to implement this? I was thinking of using Rhino (the Javascript impleme...

Custom ToolTips in Asp Using JavaScript?

Hi, In my application I am trying to implement Custom "ToolTips" and it is working fine. But the problem is: If any control like button or textbox is present just beside to the tooltip and the tooltip is long enough, then the control hides (whatever be the controls length) the tooltip. Could you please let me know the possible soluti...

How to hide parts of HTML when JavaScript is disabled?

I'm trying to accommodate users without JavaScript. (By the way, is it worth the effort nowadays?) In one html file I'd like part of it execute if scripts are ON, and another part if scripts are OFF. <noscript> tag lets me do the former, but how to achieve the latter? How can I mark a part of html so that it is not parsed by browser i...

Unobtrusive way testing JavaScript with Cucumber?

Hi, what do you prefer for testing JavaScript apps using Cucumber? I never did it before - I only used Webrat for testing plain html. I have tried Selenium, but it frustrated me and I didn't find any good documentation about Cucumber in combination with Selenium. Best regards ...

Ajax: injecting code into Internet Explorer

I'm having trouble getting the follow code to work in Internet Explorer, it doesn't seem to want to execute the code sent back from the server via Ajax, it just does nothing: var ajax = new ActiveXObject('Microsoft.XMLHTTP'); ajax.open('GET','http://fromsitewebsite.com/javascript.js',true); ajax.setRequestHeader('Connection','close'); a...

Flash detection with SWFObject

I don't quite understand the SWFObject examples downloaded http://download.macromedia.com/pub/developer/alternative_content_examples.zip'>here. Why the availability of the flash plugin is checked only by <|--[if !IE]> --> instructions. Does it mean that just IE can be without preintalled flash player? Of course no. Then why just IE is...

Wrapping a div around the document body

Hello! I am trying to dynamically wrap the contents of a document's body tag in a DIV. So far, I have used the following code: document.body.innerHTML = '<div id="wrap">' + document.body.innerHTML + '</div>'; This works, but has the unwanted side effect that other scripts on the same page stop working (I assume because changing innerH...

javascript dom insertion. Performance vs Leak ?

Hi. I'm wondering what is the right way to do dom insertion of complex elements. Until now, (with jQuery) I used to first build my element and to insert it once finished. I thought that it was the most efficient, since DOM access is costly performance-wise. But with native js, I read that to avoid memory leaks, each new dom node shou...