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!

Changing what is displayed in table

Status
Not open for further replies.

ScrabbleKing

Programmer
Mar 11, 2007
20
0
0
US
I do not know how to change what is displayed in the top right table when choosing between the 4 options. Instead of having the number of text boxes change as they do now, I want the appropriate form to be displayed in the top right table based on the option selection. NOTE: I must continue to use the DoIt function as I have other options not included here. Can someone please help?

Code:
<body>
<script>

function displayInputs(num){
var inputs = document.getElementById('inputs');
inputs.innerHTML = "";
for(i=0; i<num; i++){
var newInput = document.createElement('input');
newInput.id = 'input' + i;
newInput.maxlength = "2048";
newInput.name = "q";
newInput.size = "20";
newInput.title = "Search string";
newInput.value = "";
inputs.appendChild(newInput);
}
}


function DoIt()
{
  f = document.getElementById("qform");
	if (f.engine[0].checked)
			{
			f.action="[URL unfurl="true"]http://www.google.com/search"[/URL]
			}
}

</script>



<div style="text-align:center">

<form method="get" action="[URL unfurl="true"]http://www.google.com/search"[/URL] name="qform" id="qform" onsubmit="DoIt()">
		<input name="hl" type="hidden" value="en">

<table width="757"><tr><td width="1" valign="top">
<A href="[URL unfurl="true"]http://www.example.com"[/URL]
target=_blank rel=nofollow><IMG height=99 
alt="Example" 
border="1" width=132
</a></a></td>


<td width="916" align="center">
<br>
        <p>
		<div id="inputs">
		<input maxlength="2048" name="q" size="20" title="Search string" value="">
		</div>
		<input type="hidden" name="p">
		<input name="btnG" type="submit" value="Submit">
		<input type="reset" name="clear" value="&nbsp;&nbsp;&nbsp;&nbsp;Clear&nbsp;&nbsp;&nbsp;&nbsp;">&nbsp;&nbsp;&nbsp;&nbsp;
		</div>
</table>

<table width="756">
<br><br>
	<div style="text-align:center">
	<table><div style="text-align:left">
		<input id="Google" onclick="displayInputs(1);" type="radio" checked value="Google" name="engine"><font face="arial" size="2"><b>Google</b></font><br>
		<input id="Mapquest" onclick="displayInputs(4);" type="radio" value="Mapquest" name="engine"><font face="arial" size="2"><b>Mapquest</b></font><br>
		<input id="SuperPages" onclick="displayInputs(3);" type="radio" value="SuperPages" name="engine"><font face="arial" size="2"><b>Super Pages</b></font><br>
		<input id="Hotjobs" onclick="displayInputs(2);" type="radio" value="Hotjobs" name="engine"><font face="arial" size="2"><b>Hotjobs</b></font><br>
</table>
</table>
</form>


<form action="[URL unfurl="true"]http://www.mapquest.com/maps/map.adp"[/URL] method="get">
<fieldset>
<legend>Maps</legend>
<table cellpadding="3" cellspacing="0" border="0" style="font: 11px Arial,Helvetica;">

<td colspan="2">Address/Intersection:</td></tr>
<tr><td colspan="2"><input type="text" name="address" size="20" maxlength="80"></td></tr>

<tr><td colspan="2">City:
<td>State:</td><td>ZIP Code:</td></tr>

<tr><td colspan="2">
<input type="text" name="city" size="20" maxlength="80"></td>

<td><input type="text" name="state" size="3" maxlength="2"></td>

<td><input type="text" name="zipcode" size="10" maxlength="12"></td>

<td colspan="2" style="text-align: center;">
<input type="submit" value="Get Map">

<input type="hidden" name="CID" value="lfmapwid">
<input type="hidden" name="country" value="US"></td></tr>

</table>
</fieldset>
</form>
<br><br><br><br>

<form id="yellowpages" action="[URL unfurl="true"]http://yellowpages.superpages.com/listings.jsp">[/URL]
<fieldset>
<legend>Yellow Pages</legend>
<label for="keywords">Keyword</label> <input type="text" name="C" id="keywords" /><br />
<label for="location">Or Business Name</label> <input type="text" name="N" id="location" /><br />
<label for="location">Location (City, State, Zip)</label> <input type="text" name="L" id="location" />

		<input name="btnG" type="submit" value="Search">
		
</fieldset>
</form>
<br><br><br><br>

<form id="career" action="[URL unfurl="true"]http://hotjobs.yahoo.com/jobseeker/jobsearch/search_results.html">[/URL]
<fieldset>
<legend>Career</legend>
<label for="keywords">Position</label> <input type="text" name="keywords_all" id="keywords" /><br />
<label for="location">City & State, or Zip</label> <input type="text" name="ulm_input1" id="location" />

		<input name="btnG" type="submit" value="Search">
		
</fieldset>
</form>


</form>
</body>
 
To clarify, I don't want the Mapquest, Super Pages, and Hotjobs to display under the options as they do now. I only want them to display in the top right table when the given option is selected.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top