Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-03-2008, 04:44 PM   PM User | #1
starrzo
New to the CF scene

 
Join Date: Apr 2008
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
starrzo is an unknown quantity at this point
ASP within JavaScript - Button Looping

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

Thanks!

Here is the code as at the minute:

Code:
<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>
starrzo is offline   Reply With Quote
Old 05-03-2008, 05:25 PM   PM User | #2
A1ien51
Senior Coder

 
A1ien51's Avatar
 
Join Date: Jun 2002
Location: Between DC and Baltimore In a Cave
Posts: 2,717
Thanks: 1
Thanked 94 Times in 88 Posts
A1ien51 will become famous soon enough
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
__________________
Tech Author [Ajax In Action, JavaScript: Visual Blueprint]
A1ien51 is offline   Reply With Quote
Old 05-03-2008, 08:03 PM   PM User | #3
starrzo
New to the CF scene

 
Join Date: Apr 2008
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
starrzo is an unknown quantity at this point
Quote:
Originally Posted by A1ien51 View Post
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
starrzo is offline   Reply With Quote
Old 05-04-2008, 03:49 PM   PM User | #4
A1ien51
Senior Coder

 
A1ien51's Avatar
 
Join Date: Jun 2002
Location: Between DC and Baltimore In a Cave
Posts: 2,717
Thanks: 1
Thanked 94 Times in 88 Posts
A1ien51 will become famous soon enough
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
__________________
Tech Author [Ajax In Action, JavaScript: Visual Blueprint]
A1ien51 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:44 PM.


Advertisement
Log in to turn off these ads.