Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript inside Javascript???

Status
Not open for further replies.

rewdee

Programmer
Aug 17, 2001
295
0
0
US
I have some Javascript that creates a nice monthly calendar. I want to format specific dates. However, I can't get the dates that I want to format unless I write some VBScript to get the specified dates from the Database. The premise of the code should look like this:
Code:
if ((arrN[ii]==dd)&&(mm==currM)&&(yyyy==currY))
				{
					eval("sp"+ii).style.backgroundColor="#90EE90"
				}
//Get dates from DB
//if a date is the same as DB Value then: //eval("sp"+ii).style.backgroundColor="yellow"
If anyone can help me find a way to format the calendar date background color with dates brought back from the database. I would be forever indebted to them.

Thanks,
Bill N
 
Well it looks like your Javascript is running client-side.

I assume that your database is on the server?

If so then be aware that the server-side script runs and is done and complete before the client-side browser script is executed... so they don't really talk to each other.

Maybe you could flip it on its head and go fetch the server-side information before sending the page to the browser and, depending on what you get out of the database... send different JavaScript to the browser.


Another approach would be to use the xmlhttp object in the browser to do another request in response to some client-side event... This technique is sometimes known as AJAX... it allows you to basically set up a sort of remote procedure call using client-side script as the local host and the web server as the remote host.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top