javascript

Local and global variables in javascript

Today,I started to code a page that prompt the user to choose their PC spec,and the code is as follow <html> <title>Computer Specification Chooser</title> <head> <script type="text/javascript"> var compSpec = document.compChooser; function processorUnavailable_onclick() { alert("Sorry that processor speed is currently unavailable")...

handle multiple event in web control

How to handle multiple event in web control using javascript for ex handling onpaste and on keyup event in textarea ...

on .bind('click') it is not deleting the first div

When I click on a particular div, that div should fade out, simple, but when I click on one of the divs it deletes the div on top of the stack, i.e. when I click #sel6 it removes sel5 HTML code <div id="selc_d" class="selc" style="position:absolute; left:15px; top:200px; width:260px;"> <div id="sel5" class="sel">something</div> <div i...

Performance problems when loading local JSON via <script> elements in IE8

I have a web page with some JS scripts that needs to work locally, e.g. from hard disk or a CD-ROM. The scripts load JSON data from files by inserting <script> tags. This worked fine in IE6, but now in IE8 it takes an enormous amount of time: it went from "instantly" to 3-10 seconds. The main data file is 45KB large. How can I solve thi...

jQuery autocomplete not always working on elements

I'm trying to create a greasemonkey script (for Opera) to add autocomplete to input elements found on a webpage but it's not completely working. I first got the autocomplete plugin working: // ==UserScript== // @name autocomplete // @description autocomplete // @include * // ==/UserScript== // Add jQuery var GM_JQ ...

How to escape HTML.

I have a string which contains HTML text. I need to escape just the strings and not tags. For example, I have string which contains, <ul class="main_nav"> <li> <a class="className1" id="idValue1" tabindex="2">Test & Sample</a> </li> <li> <a class="className2" id="idValue2" tabindex="2">Test & Sample2</a> </li> </ul> How to escape just...

Select next element of a given class

Hello, I want to hide and show some form in my page. For each form theres a link, and i want that, when i click on this link, it hide and show the nearest form of the link. My code looks like this : $$('.flagLink').each(function(s){ $(s).observe('click', function(event) { // here i want to hide and show the...

small jquery parser

input is a string (var str) something like this: "<<hello there//abcd//1234>>" I want to know how to best extract the information to have this: var a = "hello there"; var b = "abcd"; var c = 1234; case a: select everything after << until first // case b: select everything after first // until second // case c: select everythin...

.NET decimal.ToString(format) in Javascript

I have a string (€#,###.00) which works fine with aDecimal.ToString("€#,###.00") in .NET, i wonder if anyone knows how this could be achieved with javascript ...

auto extendable textbox in asp.net

i have created a auto extendable textbox in asp.net using javascript.if i paste a content using ctrl + v then it's working fine but if i am right clicking and pastng then it is not working . please help. ...

what is the key code for shift+tab ?

Hi, acyally i am wiorking on key mapping but the problem is that when i press tab/down button it navigate to the next input field tab has key of 9 and down has key of 40 but to goto the previous input field (shift+tab)what is the javascript key code for that. what i want is if we press down it will go to next link but for previous ...

using dojox grid in xpages

how to use dojox datagrid in xpages? If anyone have code snippet please send it to me at [email protected] I am trying with the following code but getting nothing at the output: <xp:this.resources> <xp:dojoModule name="dojox.grid.DataGrid"></xp:dojoModule> <xp:dojoModule name="dojox.grid"></xp:dojoModule> </xp:this.r...

regex:search character still not perfect

i have this code: <script type="text/javascript"> var str="KD-R35H2UND"; var patt1=/[G|T|EE|EJU].*D/i; document.write(str.match(patt1)); </script> by using code at var patt1=... i can show like this: if i type KD-R35ED => SHOW ED KD-R35UND => UND KD-R35JD => JD KD-R35TJD => TJD KD-R35EED=> EED my problem is: if i type KD-R35GD it c...

alternative for .click() method in firefox

I have a href from that i am giving out a popup , and i want to activate this on my body overload . I am using "document.getElementbyId("myelement").click()" this is working fine in IE but FireFox is not supporting it. And i know that .click() will not be taken by firefox , but i dont have any other way to do it. Can u please suggest me ...

Is it good to use JQuery UI themes in a big high traffic website?

Is it a good way to use JQuery UI themes while implementing a high traffic website. Is it easy to edit and customize a little based on my website needs? Does it has any famous problems? want to hear your ideas about it and is it safe to use or its better to write all my CSS from scratch. Note that i checked the themes there and found ...

Difference between screen.availHeight and window.height

Hi, I am executing the following javascript on my browser(firefox) 1.console.debug("Screen height = "+ screen.availHeight); //output 770 2.console.debug("Window Height ="+ $(window).height()); //output 210 (i am using jQuery as well) What is the difference between the two? Are units of 770 is pixels and 210 is mm ? Similarly, when ...

How to save a the content into the file with neat alignment?

Hi Friends, I am having a textbox, in that i have loaded a xml file. After editing and saving the xml content into the xml file, the content is not in the right formate. While loading again, its not in the xml format How to save a the content into the file with neat alignment? Please help me For ExampleI need to save like the following ...

How to make jQuery slidetoggle effect for multiple div on same page?

it works fine for one div (function($) { $(document).ready(function(){ $('#div1').hide(); $('a.plus').click(function(){ $('#div1').slideToggle(); $(this).toggleClass("minus_icon"); return false; }); }); })(jQuery); How to make this slide toogle effect for multiple di...

Flex graph printing

Hi Guys I'm looking for a way to print / save flex graphs, preferably without changing the flex code.Is this possible to to from the client with some kind of JavaScript library.If I need to change the flex,is ALIVEPDF the way to go (converting content to pdf first) or are there simpler solutions to this. Thanks ...

Printing problem

Hi there, Time to ask an odd question. window.print(); Prints only one page of 2 pages in IE8 & IE7 even the same prints both pages in FF. Now if I cancel the print dialog and just go to File -> Print I get both pages in both IE & FF. window.print(); is included in ONLOAD Any idea why? Thanks Babak ...