javascript

Using JavaScript and XML in an HTA?

JavaScript is the web language I am most comfortable with, and I am new to HTA but I think it might be 'the' way to make a fully local dynamic page (updatable with imgs, forms, and the ability to save/load at runtime) using xml as a data source. I just can't find any info on doing so. Also if you could quickly... can I use image maps in ...

How to Fire Personal Event in Javascript

I can't fire personal events using Javascript in IE. In Firefox work great. My code is: var evento; if(document.createEventObject) { evento = document.createEventObject(); document.fireEvent('eventoPersonal', evento); } //FF else { evento = document.createEvent('Events'); evento.initEvent('eventoPer...

jQuery validate, can't get it to work.

OK, beating my head against the Javascript/jQuery wall over here, here is the code, which I simply can't get to work properly, any help is highly appreciated! Especially this bugs me, changing row 60 from c.gbForm.validator = c.dom.gbForm.validate(c.gbForm.validator); to c.gbForm.validator = $("#gbForm").validate(c.gbForm.validator); a...

how to zoom in the image and center it

Any Idea how to zoom in a image on particular point using javascript css ? I am using webkit based browser. I can zoom by specifying zoom property , like elem.style.zoom="150%", Main problem is I cannot centre the image where I want to zoom. I can get the point where I want to zoom using mouseclick. ...

Click anywhere to focus in CKEditor

In FireFox, I can click anywhere in CKEditor (350px x 250px) to place focus on a single paragraph of text located at the top of the editor. However, in IE6 (I know, but our client insists) I must click directly atop the paragraph to focus the cursor and subsequently edit the text. CKEditor creates the following: <iframe> <html> <he...

How do I open a new window with javascript and use the parent window's existing session?

I am opening a window with window.open and I am losing the server session. Is there a way to open a window with Javascript and use the same session? I need this working in IE 7 and higher. I am working with ASP.NET on the server side. The sever does not have a sessionless cookie state. <sessionState mode="InProc" timeout="15" /> ...

How to stop window unloading?

when user click a another link or refresh the page, the window will unload, how to prevent/confirm it? ...

Sandboxed Javascript Execution in an Internet Explorer Extension (BHO)

Firefox has the Sandbox and evalInSandbox(). Chrome has sandboxed execution in their content scripts (they call it isolated execution). I'm looking for the same thing in an IE browser extension. I can load a javascript file, then call evalScript(), but the code executes in the same environment as javascript that exists on the page. I ne...

Access Response Headers from ASP.Net PageMethod Call

When using ASP.Net Ajax to call PageMethods, how can I access the Http response headers from the "success" method? For example: PageMethods.DoSomething( function(result){successMethod(result)}, function(error){errorMethod(error)} ); function successMethod(result){ //------how can I access the Http response headers from here?...

Javascript RegExp string pattern

Hi. I need to check JS matches for a dynamically generated string. ie. for(i=0; i< arr.length; i++) { pattern_1="/part of "+arr[i]+" string!/i"; if( string.search(pattern_1) != -1) arr_num[i]++; } However, this code doesn't work - I presume due to the quotes. How do I do this? Many thanks. ...

What are the Alternatives to eval in JavaScript?

I have a little bit of code that looks just like this: function StrippedExample(i1, i2, i3, i4, i5, i6, i7, i8) { this.i = []; for (var i=1,j=0 ;i<9;i++) { var k = eval("i"+i); if (k > 0) { this.i[j++] = k; } } } FireBug profiler claims that second longest function is eval(), taking up t...

Javascript String argument with character reference

I have a javascript method call with a string parameter. In the string text sometimes contains html character references, e.g. &#39; I am getting an unexpected identifier error. If I have the character reference as &quot; then it works fine. Not sure why that is. Below is a code snippet of what I am trying to do. Actual method is much lo...

How can i dynamically Change onmouseover, onmouseout and onClick WITH parameters?

I have an image: <img id="reqPic" src="mark.png" /> I also have declared a flag earlier on in the page: <script type="text/javascript"> var isToolTipEnabled = true; </script> I now want to be able to check the flag and if its true, assign the onmouseover and onmouseout events. However, the onmousover event has to be changed to ano...

jQuery Pagination by div height (not item)

I am interested in using jQuery to create automatic pagination for content based on the height of the content and the div, rather than by number of items. Most pagination examples I have been able to find are based on the number of items to be paginated, rather than the height of the containing div and the height of the contents. This so...

JavaScript/jQuery - grabbing an integer from an element's id

From the following markup. <div id="my-div"> <a href="#" id="link-1">Somewhere</a> <a href="#" id="link-2">Somewhere else</a> </div> What are some options, using jQuery selectors and JavaScript for grabbing the integer in the ids? For example. $("#my-div a").click(function(){ $(this).id // ... somehow grab n from "link-...

Injecting JavaScript Outside an Update Panel

I have an aspx page with four UpdatePanels. Incidentally, each UpdatePanel corresponds to a JQuery UI tab. What I am trying to achieve is a JQuery UI modal dialog OUTSIDE the UpdatePanels that can be called from server-side code running INSIDE any of the UpdatePanels. So, inside the first UpdatePanel is an asp:Button which runs some serv...

Regular Expression for file path validation

I can't seem to find a Regular Expression for javascript that will test for the following cases: c:\temp D:\directoryname\testing\ \john-desktop\tempdir\ You can see what I'm going for. I just need it to validate a file path. But it seems like all the expressions I've found, don't work for javascript. Thank you in advance. John ...

Could somebody tell me why json2.js cannot parse this string?

I am trying to convert a pretty complicated JSON string with json2.js from json.org and I keep receiving a parse error. Unfortunately I can't figure out which character it is complaining about or if I missed an escape somewhere. At this point it would be great if I could get a second pair of eyes on it. Thanks to all who help! var js...

IE7 crashes when hiding textarea or parent container

I have a form that checks to see if another window is opened. If so, it copies the values of two input fields to existing readonly input fields and hides two editable textareas by setting the element.style.display = "none". If the other window is not opened, the readonly input fields are hidden. My issue is that when I set the textare...

javascript active directory user / groups query

Is it possible to query AD from javascript? I'm working from within SharePoint, and I can get the current SharePoint user's information using some js I found on a blog. But I'm wondering if I can then query AD to see if the current user is in a specific AD group. ...