I have recently been revamping a feedback mechanism which was built using vbscript, seen as I work on an intranet we were using the now function to take a snapshot of the time that the user made an entry.
As usual the JavaScript equivalent doesn’t work exactly the same, I didn’t want to amend the database structure so instead I thought creating a JavaScript now() function shouldn’t be too difficult. I was right.
Line wraps marked >>
function now(){
var d = new Date();
var day = checker( d.getDate() );
var month = checker( d.getMonth() + 1 );
var year = d.getFullYear();
var hours = checker( d.getHours() );
var minutes = checker( d.getMinutes() );
var seconds = checker( d.getSeconds() );
var str = month + "/" + day + "/" + year + " " >>
+ hours + ":" + minutes + ":" + seconds;
return str;
}
Quite simple really, just set the variables and construct the string to look like the VBscript now().
Last thing is the checker function, all that does is add a 0 to the start of any number below 10.
function checker( val ){
if( val < 10 ){
return "0" + val;
}else{
return val;
};
}
Simple.
Posted on April 25, 2008 at 11:10 pm
With these tags: DOM | Javascript, intranets, MS Access
I have been searching for a technique to connect to a MS Access database solely using JavaScript for some time now. Until recently I have been totally out of luck.
Before I go on and reveal the method behind the madness let me make a few things crystal clear!
This is 100% advised against for anything other than in-house work e.g. Intranets as it is not a secure method.
So anyway here’s the code to achieve it. (line wraps marked »)
var conn = new ActiveXObject("ADODB.Connection");
var rs = new ActiveXObject("ADODB.Recordset");
conn.ConnectionTimeout = 15;
conn.CommandTimeout = 15;
var connStrng = "Provider=Microsoft.Jet.OLEDB.4.0; »
Data Source=database.mdb; »
Persist Security Info=False"; // remember to escape \ if needed.
conn.open(connStrng);
rs.open("SQL Statement", conn);
var fields=new Array();
var i=0; while(!rs.eof) {
var = fields[i]=rs.fields("Field Name").value;
i++; rs.moveNext();
};
rs.close();
conn.close();
Hope it helps.
Posted on December 20, 2007 at 5:23 pm
With these tags: intranets, JavaScript, MS Access
While reading Paul Boag’s latest blog, offering it got me thinking about intranets and my experience with them from the point of a web master.
Here’s what I have to offer on the subject;
Asking doesn’t mean giving
Just because a colleague asked for a specific “something” doesn’t mean giving it to them, you have to consider a few facts with the most important being will it be used? If it’s not going to be used you will have wasted your time and to a company time is money. You also have to ask yourself does it solve a problem or are you simply re-inventing the wheel?
Money, Money, Money
I wholeheartedly agree with Paul regarding managements perception that the intranet is simply a money pit, they just don’t seem to get the fact that it does generate a ROI in regards to huge productivity gains
It’s more than just communication
Another management perception is that the intranet is just another communication tool. How wrong could they be? The intranet is able to keep colleagues updated a lot easier than most communication tools, but it’s uses don’t stop there. Colleagues are able to search for that needed contact, they can give direct feedback and for the ability to find certain forms or procedures.
Simple to use
I can’t stress this point enough. The intranet must be quicker, better and overall less painful than the older way otherwise the older way will simply be too easy to fall back on.
Posted on November 6, 2007 at 1:03 am
With these tags: intranets, web development
Post Tags
Subscribe
Here are my RSS feeds that you can subscribe to:
About Me
Hi! My names Damian Poole, I'm a huge web standards advocate and HTML ninja, when I'm not coding elegant web sites I like to procrastinate my time on world of warcraft.