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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript - not sure what to do or where to palce it

Status
Not open for further replies.

nospace52

Technical User
Jan 28, 2003
27
0
0
US
New to Javascript:
I'm putting together a web page for Supervisors and Employee's. The Superviors will be able to see the reason the person in out in the "Remarks" Field. The database would have a Remark like "Meeting/AM" or "Meeting/PM".
Instead of having 2 databases the person would update 1 and then copy it to another directory and rename the database to
out.mdb.

My question is:
How or what JavaScript would I need in the Employees web page that when a Remark = "Meeting/AM" it would show "AM"
when the web page is open.

Here is what I have so far for the Employees web page.
**Out.asp**
Option Explicit

'Define our variables.
Dim cnnDB, strQuery, rsInfo ,cnndb1 ,authUser


'Create an instance of the Connection object.

Set cnnDB = Server.CreateObject("ADODB.Connection")


'And open it.
cnnDB.Open "out"


'Build our SQL query string.
strQuery = "SELECT OUT.Name, OUT.REMARKS FROM OUT WHERE (((OUT.REMARKS) Is Not Null)) ORDER BY OUT.Name;"

'Execute the query and return a recordset.
Set rsInfo = cnnDB.Execute(strQuery)

%>
<!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;>
<html>

<head>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<meta name=&quot;GENERATOR&quot; content=&quot;Microsoft FrontPage 4.0&quot;>
<meta name=&quot;ProgId&quot; content=&quot;FrontPage.Editor.Document&quot;>
<title>Out Today</title>
</head>

<body bgcolor=&quot;#C0C0C0&quot; bgproperties=&quot;fixed&quot;>

<h2 align=&quot;center&quot;>Out Today</h2>
<p align=&quot;center&quot;><b><i><u><span style=&quot;text-transform: uppercase&quot;><font face=&quot;Book Antiqua&quot; color=&quot;#0000FF&quot;>**
Information will be updated each workday by 9 am **</font></span></u></i></b></p>
<hr>
<div align=&quot;center&quot;>
<center>
<table border=&quot;4&quot; bgcolor=&quot;#C0C0C0&quot; bordercolor=&quot;#0000FF&quot; bordercolordark=&quot;#FF0000&quot; bordercolorlight=&quot;#000080&quot;>
<tr>
<th><strong><u>Name</u></strong></th>
<td width=&quot;25&quot;><br>
</td>
<th><strong><u>Remarks</u></strong></th>
<td width=&quot;25&quot;><br>
</td>
</tr>
<strong><%
'Iterate through the recordset, pull
'out the required data, and insert it
'into an HTML table.
Do While Not rsInfo.EOF
%>
</strong>
<tr>
<td><strong><% =rsInfo(&quot;Name&quot;) %></strong></td>
<td align=&quot;center&quot; width=&quot;25&quot;><br>
</td>
<td><strong><% =rsInfo(&quot;Remarks&quot;) %></strong></td>
<td align=&quot;center&quot; width=&quot;25&quot;><br>
</td>
</tr>
<%
'Move to the next record in the
'recordset
rsInfo.MoveNext

Loop

'Close the recordset.
rsInfo.Close

'And close the database connection.
cnnDB.Close
%>
</table>
</center>
</div>
<p align=&quot;center&quot;> </p>
<p align=&quot;center&quot;><font color=&quot;#0000FF&quot;><strong>Page was last updated on</strong></font></p>
<p align=&quot;center&quot;><font color=&quot;#0000FF&quot;><strong><!--webbot bot=&quot;Timestamp&quot;
s-type=&quot;REGENERATED&quot; s-format=&quot;%A, %B %d, %Y&quot; --></strong></font></p>


</body>

</html>


Thanks - Have a great day

< I want to work in Theory - everything and everybody works in Theory !!>
 
You can use document.write like so:

<html>
<head>
</head>
<body text=&quot;red&quot;>
<table width=&quot;120&quot; border=&quot;0&quot; bgcolor=&quot;white&quot; cellpadding=&quot;7&quot;>
<tr>
<td bgcolor=&quot;blue&quot;>LazyBones</td>
<td bgcolor=&quot;blue&quot;>
<script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;>
//tm = <% =rsInfo(&quot;Remarks&quot;) %>; //commented for testing
tm = &quot;Meeting/AM&quot;; //You can test by changing AM to PM
if(tm.indexOf(&quot;AM&quot;) > -1) {
document.write(&quot;AM&quot;); }
else { document.write(&quot;PM&quot;); }
</script>
</td>
</tr>
</table>
</body>
</html>

2b||!2b
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top