I have read the following message from "Darius Fatakia"
<darius_fatakia@yahoo.com>
and have decided to lend my vast knowledge.
The writer said:[color=blue]
> 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[i] =~ /document.myform.title.value/) {
> //title[i].test(document.myform.title.value)) {
> document.myform.description.value = description[i];
> 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>
>
>
>
>[/color]
and my reply is:
document.myform.description.value = description[i]; should be
document.myform.description.value = title[i];
For the color look for info on CSS.
I don't understand the slash before the > and if title[i] =~ unless
that is something in xml which is beyond my knowledge.
--
Dennis M. Marks
http://www.dcs-chico.com/~denmarks/
Replace domain.invalid with dcsi.net
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----