...

View Full Version : ASP within JavaScript - Button Looping



starrzo
05-03-2008, 04:44 PM
Hello, recently I constructed a website intent for being accessible by disabled users with just one button...enter. Basically my navigation consists of submit buttons which automatically are 'looped' through every 1.5 seconds. The thing is, the website administrator needs to be able to adjust the speed of the looping therefore I need to call it from the database. As you can see in the code below the speed is set to 1500. What do I need to write in there to call that number from a database say for example called 'buttons.mdb' in a table called 'navigation' in a field called 'time'?

I'd really appreciate your help on this, gotta present the website on monday afternoon :cool: :thumbsup::thumbsup:

Thanks!

Here is the code as at the minute:




<script>

function pressTab(name)
{

var elem = document.getElementById(name);
elem.focus();
return;
}
function init(name){
setTimeout("pressTab('"+name+"')",1500);
return;
}

function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) window[args[i]].location=args[i+1];
}
</script>

A1ien51
05-03-2008, 05:25 PM
JavaScript can not access the database. You need to use a serverside language such as php to get the value. Better yet would be to find a way to not have the value looked up from the database every time the page is hit. That is just a waste of processor power.

Eric

starrzo
05-03-2008, 08:03 PM
JavaScript can not access the database. You need to use a serverside language such as php to get the value. Better yet would be to find a way to not have the value looked up from the database every time the page is hit. That is just a waste of processor power.

Eric

Sorry, maybe my choice of wording was not good. I had intended to mention I was looking for a small piece of ASP to contact the database, although I did mention it in the title...'ASP within Javascript - Button Looping'.

The other thing is that I am not too conecerned about processor power at the minute, just simply if it works for now. Could you help me?

Thanks,

Conor

A1ien51
05-04-2008, 03:49 PM
Not sure what the issue is. Have your asp page read the value form the database and write it out to the page like you would any other content.

var foo = "<your asp code>";

Eric



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum