Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Apr 2008
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    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>

  • #2
    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
    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]

  • #3
    New to the CF scene
    Join Date
    Apr 2008
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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

  • #4
    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
    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]


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •