javascript

How can I change the style of the document via JavaScript?

That would go like this * {margin:0; padding:0;} in CSS. ...

how can I change en.jscript file to farsi.jscript?

I use processmaker software and I want change english language to persian. ...

Textarea validation does not work Javascript

here is the code sample: HTML: <form id="information" name="information" action="#" method="post"> <textarea name="text" rows="10" cols="10"> </textarea> <input type="submit" value="submit"/> </form> Javascript: window.onload=init; function init(){ document.getElementById('information').onsubmit=validateForm; } fu...

what's the difference between ajax.org platform and ajax.org O3?

what's the difference between ajax.org platform and ajax.org O3? I tried to see this from site, but I didn't understood much. ...

handling event bubling in jquery

iam having links as shown below <a item='1' href='javascript:void(0)'><img class='icon1' /><span>text1</span></a> <a item='1' href='javascript:void(0)'><img class='icon2' /><span>text2</span></a> <a item='1' href='javascript:void(0)'><img class='icon3' /><span>text3</span></a> <a item='1' href='javascript:void(0)'><img class='icon4' /><...

Assign a method operator() to an object.

Hello I'm having this problem in a real-world Project. http://stackoverflow.com/questions/124326/how-to-convert-an-object-into-a-function-in-javascript I need at least as Steve said "to assign a method operator() to an object". Re-assign is not an option, because the object is too complex and it's not created within Javascript. I hav...

JavaScript nested inheritance

I've been trying to get my head around JavaScript inheritance. Confusingly, there seem to be many different approaches - Crockford presents quite a few of those, but can't quite grok his prose (or perhaps just fail to relate it to my particular scenario). Here's an example of what I have so far: // base class var Item = function( type...

Catching DTE event in Javascript

I am trying to catch Visual Studio Extension events in browser javascript, DTE is available through window.external: window.external.DTE.Events.SolutionEvents.Opened = ... Access is ok up to "Events", but a SolutionEvents seems not to be found. I've checke the #imported tlb, _Events does have a get_SolutionEvents member. DTE is the c...

How to change cursor for the whole document (not only within the body) via JavaScript?

In the way it's cross-browser, using JavaScript only. ...

How to find cursor position in a contenteditable DIV?

Hello, I am writing a autocompleter for a content editable DIV (need to render html content in the text box. So preferred to use contenteditable DIV over TEXTAREA). Now I need to find the cursor position when there is a keyup/keydown/click event in the DIV. So that I can insert the html/text at that position. I am clueless how I can fin...

How do I get the cell value from a table using JavaScript?

<td> <input type="button" name="buton" id="x2" value="2" onclick="swap(id)";/> </td> This is the button in a table when it is clicked it's id is passed as parameter to function "swap" as below: function swap(x) { document.write(x); } It is successful in getting the id but not the value;when i am trying in this way: func...

Javascript and Performance, Use jquery or pure script?

I have a big data should be shown in a Table. I use javascript to fill the table instead of priting in HTML. Here is a sample data I use: var aUsersData = [[1, "John Smith", "...."],[...],.......]; the problem is that Firefox warns me that "There is a heavy script running, should i continue or stop?" I don't want my visitors see the...

Ideas for a comprehensive Javascript assignment

I am likely to be part of the teaching team for the web programming course at my University next semester and I was wondering what kind of Javascript assignment to hand out to the students. The course is not an introductory one from a programming perspective. It is assumed that the students are familiar with OOP, data structures and al...

load page into div and keep the same page in div after refresh

hello friends, I have loaded a page into div using jQuery. But when i refresh the webpage will go to initial stage? How can i load the same page after refresh? let the inital stage is $("div").load("a.htm") after clicking on a button it will load $("div").load("b.htm") now the division contains b.htm and after refreshing it is...

Selection ranges in webkit (Safari/Chrome)

Hi, I'm using a content-editable iframe to create a syntax-highlighter in javascript and one of the most important things is to be able to indent code properly. The following code works just as it should in Firefox: // Create one indent character var range = window.getSelection().getRangeAt(0); var newTextNode = document.createTextNod...

GetElementById IE

Hello. I have this: <input type="hidden" id="aid" value="<? echo $_GET['id']; ?>"></div> and var aID = document.getElementById('aid'); var postFile = 'showcomments.php?id='+ aID.value; $.post(postFile, function(data){ Why will this only work in FF and not IE? ...

Hacking around the default behavior of AddSearchProvider on IE

I am wondering if someone has been able to hackaround the following :- 1) Making AddSearchProvider work without any user initiated action. For example, on loading the page. 2) Checking the Default option in the popup that is shown. Regards, harsh ...

Overflow hidden elements

I'm wondering how can I access overflowing elements. I would like to copy their content in to another div or something. Lets say I got a ul with 5 li elements, but only two are visible. So.. How can I get other 3 elements in another div? ...

get list of all <input objects in javascript, without accessing a form object

I need to get all the input objects and manipulate the onclick param. the following does the job for links. looking for something like this for input tags. for (var ls = document.links, numLinks = ls.length, i=0; i<numLinks; i++){ var link = unescape(ls[i].href); link = link.replace(/\\'/ig,"#"); ...

How to auto-complete a form field with a city and state?

I have a free form textfield that allows a user to type in a city and state, e.g. "Chicago, IL". What I would like to do is when the user starts typing, to begin displaying suggestions of completed city+state combinmations (much like how Stackoverflow auto-suggestions the "tags" field below when you create a question). Question: Does a...