javascript

javascript: how to make input selected

i have to use the following function, to change the input's type <input class="input" id="pas" type="text" name="password" style="color: #797272;" value= "<?php if ($_POST[password] != '') {echo '';} else {echo 'Ծածկաբառ';}?>" ...

A better JavaScript version of addslashes and stripslashes?

I am using these 2 functions: http://javascript.about.com/library/bladdslash.htm But JSLint complains 'Bad Escapement' on this line: str=str.replace(/\\0/g,'\0'); [Edit] I converted to 2 lines, and now the first line is the one that fails JLint: var rep = '\0'; str=str.replace(/\\0/g,rep); So it is the '\0' can you help? ...

hasOwnProperty in javascript

function Shape() { this.name = "Generic"; this.draw = function() { return "Drawing " + this.name + " Shape"; }; } function welcomeMessage() { var shape1 = new Shape(); //alert(shape1.draw()); alert(shape1.hasOwnProperty(name)); //this is returning false } "welcomeMessage" called on the body.onload even...

How to make an Adobe Air App connect to a webservice and update it content when connected

I'm building an air app (A screensaver). What I want to do is to let the app check a webservice (preferably PHP, java axis2 would also help) for images and text content etc. I may even do some DOM restructuring (using jQuery). Any suggestions and pointers would be welcome. Of Course code snippets would be appreciated :-) thanx Pk Anane ...

focus doesn't work in IE

i have the following function function change() { var input=document.getElementById('pas'); var input2= input.cloneNode(false); input2.type='password'; input.parentNode.replaceChild(input2,input); input2.focus(); } but focus() ...

Why does document.querySelectorAll return a StaticNodeList rather than a real Array?

It bugs me that I can't just do document.querySelectorAll(...).map(...) even in Firefox 3.6, and I still can't find an answer, so I thought I'd cross-post on SO the question from this blog: http://blowery.org/2008/08/29/yay-for-queryselectorall-boo-for-staticnodelist/ Does anyone know of a technical reason why you don't get an Array? ...

JavaScript: Reference a functions local scope as an object

When I call a function, a local scope is erected for that call. Is there any way to directly reference that scope as an object? Just like window is a reference for the global scope object. Example: function test(foo){ var bar=1 //Now, can I access the object containing foo, bar, arguments and anything //else within the loca...

How to write this JavaScript code without eval?

How to write this JavaScript code without eval? var typeOfString = eval("typeof " + that.modules[modName].varName); if (typeOfString !== "undefined") { doSomething(); } The point is that the name of the var that I want to check for is in a string. Maybe it is simple but I don't know how. Edit: Thank you for the very interesting an...

datepicker send data to database

How i can get picked data in inline mode. With popup its easy to do with input tag <input type="hidden" id="defaultInlineDatepicker" size="60">. And when i can write data to database. But i need calendar on my page inline. <p> <span id="defaultInlineDatepicke" class="datepicker"></span>&nbsp; </p> <script> $('#de...

Crossdomain settings in Google Chrome

Hi Folks, I'm wondering, in IE & Firefox you're able to setup the browser, to allow cross-domain calls. I can't find any option in chrome for that (actually, there are in general not too much options at all...) are there any about:config like things? Kind Regards --Andy ...

How to split HTML code with javascript or JQuery

Hi I'm making a website using JSP and servlets and I have to now break up a list of radio buttons to insert a textarea and a button. I have got the button and textarea to hide and show when you click on the radio button it shows the text area and button. But this only appears at the top and when there are hundreds on the page this will b...

How to determine what in my script is blocking my HTML rendering?

I have a web application that uses quite a bit of JavaScript. When the page loads, it's very clear visually that something is blocking the rendering of a particular portion of the web site. This portion is generated by a Tabber Tabify JavaScript library. How can I determine what's blocking the HTML rendering specifically so that I can ...

Changing document.domain to completely other domain

I'm trying to prove that changing document.domain can be used only for cross scripting on the same upper level domain. For example if i will try to change document.domain to "google.com" on page which is located on www.test.com I will get a security exception in FF. Does anybody know where to locate an official proof of that? ...

Looking for downloadable demo of a .Net service accessed through a pure JavaScript client, without relying on IIS to serve the service.

I am told that the configuration below is possible, but have had significant difficulty in finding instructions on how to set it up. While I'm trying to muddle my way through this on my own, maybe stack-overflow knows of better sources for documentation: I am looking for a walkthrough, including a downloadable, working example, for sett...

Javascript RegEx Question

Hello, How to find below comment block(s) with javascript/jquery regex: /* some description here */ It may even look like: /* some description here */ Or /* some description here */ ...

Is it possible to use JavaScript to submit an unnamed form from outside an iFrame?

I know that may sound silly, but I'm trying to submit a form on a page inside an iFrame, from the parent site. Here's an example of the form: <form action="/add_email" method="post"> <div class="field"> <label for="newEmailAddress" style="width: auto">Add new email address</label> <input type=...

Javascript crash / Ajax in IE after 5 times

Hi Please give a look at this site. maimei.ch After 5 times opening a new site via ajax (fancybox) it crashes in IE? One little thing is that i load a whole asp.net site via ajax in the new window. so viewstate and other overhead is there twice after. could this be the problem? if yes, why just after 5 times?. is it possible to call...

Javascript regex to match a string that ends with some characters but not with a particular combination of those

Let's say using Javascript, I want to match a string that ends with [abcde]* but not with abc. So the regex should match xxxa, xxxbc, xxxabd but not xxxabc. I am utterly confused. Edit: I have to use regex for some reason, i cannot do something if (str.endsWith("abc")) ...

How to get the mouse position without events (without moving the mouse)?

Is it possible to get the mouse position with JavaScript after page loads without any mouse movement event (without moving the mouse)? ...

datatable scroll

I have a dataTable and I am using scrollBar if the records exceed ,lets say 20. The problem is after post back the div scroll bar goes to top. Is there anyway I can fix the resetting of scroll of div after post back. Thanks. ...