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 error

Status
Not open for further replies.

dagoat10

Programmer
Jun 3, 2010
74
US
I was trying to get a javascript function to change my table border but two thing occured, my value in the input box does not keep the value of the current query to my database, so the border stays one color instead of changing depending upon input

Code:
<html>
<head>
</head>
 
<script language="javascript"> 
 
function changeBorder()
{
	if(document.getElementById('FindP').value='Houston Texans')
	{
		document.getElementById('T').style.borderColor='blue';
	}
	if(document.getElementById('FindP').value='Washington Redskins')
	{
		document.getElementById('T').style.borderColor='red';
	}
}
</script>
 
 
<body onLoad="changeBorder()">
 
 
<h2>Search</h2> 
<form name='search' method='post' action='Team_Roster.php'>
Enter Team Name: <input type='text' id='FindP' name='find' value='Houston Texans' /> 
<input type='hidden' name='searching' value='yes' /> 
<input type='submit' name='search' value='Find' /> 
</form>
<h2>Results</h2><p><table id='T' border='5'>

* I took the results out because that is too much to post and the results work fine.

according to the current value of my input box the border should be blue, but it is still red and the input value does not stay with the current team. What's wrong?
 
>if(document.getElementById('FindP').value='Houston Texans')
[tt]if(document.getElementById('FindP').value[highlight]==[/highlight]'Houston Texans')[/tt]
See the difference? Same for another conditional.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top