The following script returns 20 instead of 21!
var d = new Date("2010/03/21");
document.write(d.getDate());
What am I doing wrong? Is this a JavaScript bug?
if a user types in an input say 3 into a text box three small text boxes should be shown below or in a popup through javascript or jquery .How can this be done...
<input type="text" name="order">3</input>
Thanks..
In JavaScript:
"ab abc cab ab ab".replace(/\bab\b/g, "AB");
correctly gives me:
"AB abc cab AB AB"
When I use utf-8 characters though:
"aß aß? ?aß aß aß".replace(/\baß\b/g, "AB");
the word boundary operator doesn't seem to work:
"aß aß? ?aß aß aß"
Is there a solution to this?
I have a string called myString that contains some part the end that I do not want:
var myString = 'The sentence is good up to here foo (bar1 bar2)';
var toBeRemoved = 'foo (bar1 bar2)';
How can I use best JavaScript regex to remove the part I don't want. The method replace() seems to have a problem with the parentheses.
When using Google Chrome, I receive the following error message:
Error:
Uncaught SyntaxError: Unexpected token <
It occurs directly after my doctype declaration at the top of my HTML page
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Any ideas what this JavaScript error message is? It only seems to occur with Google Chrome (works fine in Safari, Firfox and IE)
Trying to do something similiar to how sourceforge starts the download on the page, and uses a direct link in case it doesn't work.
I can't seem to locate the javascript they use to start the downlaod popup.
Exampe link: http://sourceforge.net/projects/htmlparser/files/Integration-Builds/2.0-20060923/HTMLParser-2.0-SNAPSHOT-bin.zip/download
I am being asked to make a "download" button that downloads the contents of a textarea on the same page as a file, with the browser's "Save As" dialog showing up. Copy/paste would do the job just fine, but it is a "requirement".
Right now, I am just posting the contents of the textarea to the server, which echos them back with "Content-disposition: attachment" slapped on. Is there a way to do this with just client-side Javascript?
I'm looking for articles or books that discuss schemes and techniques adopted by pro javascript developers to store and organize data with html tags. In other words, how to emulate xml data storage with html as semantically as possible.
Some various solutions that I've seen mentioned in passing are custom DTD, custom attributes with xhtml, early adoption of html5 and its data- attribute.
Now, I'm looking for some tangible material that goes in depth with these concepts.
I am dynamically creating a hyperlink in the c# code behind file of ASP.NET. I need to call a JavaScript function on client click. how do i accomplish this?
thanks in advance
var obj = document.getElementById("header");
Given the above code snippet, I should be able to wire event handlers. For example, I can wire onMouseDown to the mouse down event, the issue is that Visual Studio does not display this in the Intellisense.
I've tried this on both a standalone Javascript file, as well as an MVC project to no luck.
Is there anything I'm doing wrong - or is there a way to resolve this?
In Javascript, how do I get the number of weeks in a month? I can't seem to find code for this anywhere.
I need this to be able to know how many rows I need for a given month.
Thanks for all the help.
text = text.replace(/\.(?=[a-zA-Z0-9\[])/g, "<span style='background-color: #FF00FF'>.</span>");
I want to use javascript to highlight all full stops that is followed by letters, numbers and [. The above expression works for letters and numbers, but not bracket. Any idea what's wrong?
Since I'm building a dynamic site, I need to track the changes between pages, ie. Ajax calls, POST, GET stuff and similar stuff.
I'm looking for the same functionality like in Firebug (where you can enable "persistent" and the console is not cleared every time you reload a page or submit a form.
So, my questions is: is there a way to make Google Chrome JavaScript console persistent?
(And if yes, how?)
Hi,
Any one help to to get the extact value from the JavaScript date time utc format. I am using a C# web method which is returning a date and I have to set that date with Timezone.
Thanks
Hi,
I've read that you can disable (make physically unclickable) a html button simply but appending 'disable' to its tag, but not as an attribute, as follows:
<input type="button" name=myButton value="disable" disabled>
Since this setting is not an attribute, how can I add this in dynamically via JavaScript to disable a button that was previously enabled?
Is there a way to add a method to all javascript functions without using the prototype library?
something along the lines of :
Function.prototype.methodName = function(){
return dowhateverto(this)
};
this is what i tried so far but it didnt work. Perhaps it is a bad idea also if so could you please tell me why?
if so can I add it to a set of functions i choose
something like :
MyFunctions.prototype.methodName = function(){
return dowhateverto(this)
};
where MyFunctions is an array of function names
thank you
I used to write javascript functions
Utility = function (){};
Utility.SwapMember = function(name,id){
return ...
};
Utility.GetCommnaNo = function(originalNo){
return ...
};
..
alert(Utility.GetCommnaNo(totalCnt));
it's quite a bit nice way to make functions get together.
But I think there must be better way.
do you have any better way?
Hi,
I'm looking for an e-book reader/displayer similar to the technology used at flashpage (http://www.flashpageflip.com/Online-Demo.asp) but in Javascript?
Any ideas/links much appriciated!
Thanks
I have created a XUL application, it has got a link for navigating to previous page. This is my link <a href="javascript:history.back();">Back</a>, unfortunately it is not working!!!
In firefox is working as expected, when I run it in XUL it is not working.
Any idea, why it is not working.
Thanks,
Rajeesh
I have to do a postback automatically when a user visit a page. How can I run this postback only once?
javascript:__doPostBack('dnn$ctr424$ViewLogin$btChange','')
Hi all,
I am developing a small facebook application.
In my application I need offline_access and email permission. I've been succesfully prompting the user for permission using
FB.Connect.showPermissionDialog("email,offline_access");
But what I really want to do is prompt the user with a require permission dialog, not request.
Does anyone know how to do that in javascript?
Thank you very much!
Ok here is my question in javascript you can declare a variable and be undefined you can apply variable == undefined, I know that but how you can compare a value that you dont know yet if it's in the cpu memory. I have a class which is create it when the user click on a button. before this the class is undefined there no exist in any where so how can I compare it?
without using try{}catch(e){} is there a way????
I have a JS app that an user interacts with. I need to save the appearance of the interface at the current time, crop out the part that I need (or only shot the part that I need by specifying the div), and send it back to the server.
Clearly any external services would not be able to do this, I need a javascript (or flash) script that can save the screen appearance. Is this possible?
Thanks.
Also, as the comment below says, I cannot use Active X.
I have a small command line javascript routine that I usually run from the command line using cscript in windows. I'd like to be able to pass in arguments hopefully along the lines of...
%:cscript doSomethingToFile.js FileInQuestion.txt
Any insight on how to do this? Thanks much.
A friend and I had an argument last week. He stated there were no such things as classes in Javascript.
I said there was as you can say var object = new Object()
he says "as there is no word class used. Its not a class.
-- Whats your take on it guys?
thanks.