two questions

D

Darius Fatakia

hi,

i am new to javascript and want to do two things. first, i'd like to change
the font color of text that is in a particular <td> tag. how do i do that (i
can change the background color, but i can't seem to figure out the font
color)?

also, i have an array of book titles and i would like the web user to be
able to be able to search through them. thanks so much. this is the code:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC
"-//w3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Find a Book</title>
<link rel="stylesheet" href="books.css" type="text/css" />
<script language="JavaScript" type="text/javascript">
<!--
function findBook() {
var i;
var found = 0;

var title = new Array("Death in Venice", "A portrait of the artist as a
young man", "A room with a view", "The house of spirits", "Of love and
shadows");
for(i = 0; i < title.length; i++) {
if(title =~ /document.myform.title.value/) {
//title.test(document.myform.title.value)) {
document.myform.description.value = description;
found = 1;
break;
}
}

if(!found) {
document.myform.description.value = "Book not found";
}
return true;
}
-->
</script>
</head>
<body>
<br />
<h1>b o o k l a n d</h1>

<form name="myform" id="myform" action="">
<img src="spacer.gif" height="5" alt="s1" />
<table width="600" align="center" border="1"><tr><td>
<img src="spacer.gif" height="25" alt="s2" /><br />
<table width="350" align="center" border="0">
<tr>
<td valign="top" width="40%"><b>Author name:</b></td>
<td><input type="text" name="author" id="author" size="30" /></td>
</tr>
<tr>
<td valign="top"><b>Book title:</b></td>
<td><input type="text" name="title" id="title" size="30" /></td>
</tr>
<tr><td></td>
<td><input type="button" name="find" id="find" value="Find Book"
onclick="findBook();"/>
<input type="button" name="clear" id="clear" value="Clear Info"
onclick="document.myform.author.value=''; document.myform.title.value='';
document.myform.description.value=''"/>
</td>
</tr>
<tr><td><img src="spacer.gif" height="20" alt="s3" /></td></tr>
<tr>
<td valign="top"><b>Description:</b></td>
<td><textarea name="description" id="description" rows="15"
cols="40"></textarea><br /><img src="spacer.gif" height="25" alt="s4"
/></td>
</tr>
</table>
</td></tr></table>
</form>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,241
Latest member
Lisa1997

Latest Threads

Top