I'm looking to return DATE ONLY for yesterday's date. No seconds,
milliseconds. Formatted either yyyy/mm/dd or mm/dd/yyyy. VB does it so
easily Date()-1 will return 03/27/2007 if today is 03/28/2007. Why so
many hoops for javascript? Any ideas?
The user clicks on the delete icon, and gets a JavaScript client-side popup to confirm that he wants to delete. I am passing this client-side function a contactID.
Then, I want to send the result of this confirm (true|false) to a server-side VBScript function, along with the contactID. The VBScript function will then perform a delete in the database for the specified contactID.
I have seen many examples about sending stuff back and forth between JavaScript and VBScript, between server and client, but all the examples I see are just popping up generic alerts and such. I need to execute some JS on the client side, return a value, and send it to a VBScript function on the server side.
I have some pages with this VBScript code, which obviously does not work in Firefox. How can I convert this to Javascript in order for my web page to work in Firefox ? It basically fills a drop down with a list of dates that a user can select. Code:
I need some help converting this VBScript over to JavaScript so that the calculations will work properly in browsers other than IE.
You can take a look at Turn 2 Design Code: for a feel about what I'm trying to do, but basicly, I just need to calculate the cost of the selected items based on the selected quantity of that item.
The only thing I know about JavaScript is the small Pop-up scripts I've been able to litterally copy and paste to implement. So, please, dont just post code, post an explaination of whats going on and why so I can try to figure it out. Code:
Not sure whether this should go in the JavaScript or VBScript/ASP section, but I'll try here anyway.
I have an ASP include file that contains both VBScript and JavaScript code. The VBScript processes some information and has an onChange event which calls a JavaScript function. Within this javascript function I want to access a recordset and retrieve a value using a variable from the javascript. Here's the code from the JavaScript section. Code:
I want to do some Win32 application automation from JavaScript. Is it possible? Failing that, is there a way to execute an application from JavaScript?
Does anyone know a way of passing parameters into a Javascript script 'from outside' via additions to the URL -- similar to (or even the same as!) the idea of CGI parameters?
I have the following function to get the total qty:
function calttl() { var ttlqty ttlqty=0 for (i = 0; i <= document.qtymain.orderdetail.length-1; i++) { ttlqty = ttlqty + document.qtymain.qty.item(i).value }
}
The problem I have is the document.qtymain.qty.item(i).value I get look like a string, so the number I get for ttlqty is not add up the number but concatenate.
How do I convert the value I get to a number in javascript?
I am using a location in my javascript: '../../myfolder/myfile.asp'
I want to make the script reusable by pages in different folders. The 'myfolder' is in the root of my site. How can I target this from any other folder such as the vbscript server.mappath('myfolder/myfile.asp')?
What is the best way to get just the script name that is running without the path and parameter info? This would be the JavaScript equivalent to the PHP command:
I got two ASP pages. One is ASP email form (I'm using Persist ASP Email component). Another one has all file links in it. For example, when user click Outlook course hyperlink. It will pop up another window with outlook course PDF file. (All PDF files are already in the server).
What I am trying to do is: When user click the "Add Email" hyperlink, it will add that course name and filepath into ASP/VBScript Dictioanry Object. After the user finish and click "Attach to email" button. All the files will be attached in the email as an attachment.
Because I am not familar with VBScript. So, can Javascript add items to ASP Dictionary Object?
Can anyone redirect to any online tutorials, articles, code of how to upload a file using HTTP PUT method and JavaScript or VBScript to a server running Apache 2.0 that uses CGI + PERL.
How to create configuration entries in httpd.conf for supporting HTTP PUT method.
How to code with AJAX to post uploaded file content to the server using PUT method ?
Can I use javascript to create a menu. then insert the value to it? I mean.. If i got 1 page, and 1 textbox. can I pass in the value in the textbox to a vbscript Msgbox or Menu, then i change the value in Menu, maybe use combo box or listbox. then i select it and click ok, the value in my page can get it and chage the default value? Thank!
ps: I want a pop up "menu", not a pop up "window"... or maybe in Vb6 we calll a form
In PHP, there is a require_once() function which includes a file only if it is not already included. Is there an equivalent function in Javascript (one that checks if a .js file has been included)? If not a straight-up function, is there some other way to check if a javascript file has been included already?
Recently while messing with dates, I noticed an odd quirk in javascript with new Date(), i.e. if someone enters an invalid date, such as 2/29/2003, javascript creates the new date as 3/1/2003.
Having a look around, I couldn't find any scripts that took advantage of this for the sake of date validation... probably someone here has done this before, but I'll post it anyway.
The idea is that if javascript creates a new Date() with a different month, then obviously the date entered is not valid. Most of the scripts I saw used some math to divide by leap year, yadda yadda yadda, but with this feature (?) of javascript, it seems unnecessary.
Right now this code only validates mm/dd/yyyy, but it should be easy to modify to support other formats:
function isDate(sDate) { var re = /^d{1,2}/d{1,2}/d{4}$/ if (re.test(sDate)) { var dArr = sDate.split("/"); var d = new Date(sDate); return d.getMonth() + 1 == dArr[0] && d.getDate() == dArr[1] && d.getFullYear() == dArr[2]; } else { return false; } }
Here's a shorter version that works if you pass in the values separately:
function isDate(mm,dd,yyyy) { var d = new Date(mm + "/" + dd + "/" + yyyy); return d.getMonth() + 1 == mm && d.getDate() == dd && d.getFullYear() == yyyy; }
I have written a javascript to compare current date with the date that user has entered in the form. the user enters in YYYY-MM-DD format. here'z the code:
var today= new Date(); var stDate= new Date(document.form[0].startDate.value); var day=0; var month=0; var year=0; var todayStr; day= today.getDate(); month= today.getMonth()+1; year= today.getFullYear(); todayStr= new Date(year + "-" + month + "-" + day); alert(todayStr); if(todayStr>stDate) { alert("Current date is greater");}
but todayStr gives NaN . and comparison gives no result.
I am trying to use javascript code so that on loading of a webpage, the page displays the day, date, month and year words. So far I have come up with the following but it doesnt seem to be working: Code: