some "search engine" code need help!!

Discussion in 'HTML & Website Design' started by cissss, Oct 31, 2007.

Thread Status:
Not open for further replies.
  1. #1
    The following code works fine with FIREFOX on the local machine

    but can't work with FIREFOX on the server

    any idea?


    <TABLE cellSpacing=0 cellPadding=0 width=100% align=center bgColor=#eaeaea border=0>
    <TBODY>
    <TR>
    <TD>
    <TABLE height=20 cellSpacing=1 cellPadding=0 width="100%" align=center border=0>
    <TBODY>
    <TR>
    <TD height=15>
    <SCRIPT>
    <!--
    function searchjc()
    {
    if(form_search.jcgoogle.checked)
    window.open("http://www.google.com/search?hl=en&q="+form_search.key.value,"");
    if(form_search.jclive.checked)
    window.open("http://search.msn.com/results.aspx?q="+form_search.key.value,"");
    if(form_search.jcyahoo.checked)
    window.open("http://search.yahoo.com/search?p="+form_search.key.value,"");
    return false;
    }
    //-->
    </SCRIPT>

    <TABLE cellSpacing=1 cellPadding=0 width="100%" border=0>
    <FORM name=form_search onsubmit=return(searchjc())>
    <TBODY>
    <TR>
    <TD>
    <TABLE cellSpacing=1 cellPadding=2 width="100%" border=0>
    <TBODY>
    <TR>
    <TD width="99%"> <INPUT size=40 name=key> <INPUT class=button type=submit value=Search name=submit> <FONT color=#666666></FONT> <br />
    <span class="style2">Web:</span>
    <INPUT type=checkbox CHECKED value=google name=jcgoogle> <A href="http://www.google.com/"><FONT color=#000000>Google</FONT></A>
    <INPUT type=checkbox value=yahoo name=jcyahoo> <A href="http://www.yahoo.com"><FONT color=#000000>Yahoo</FONT></A>
    <INPUT type=checkbox value=live name=jclive> <A href="http://www.live.com/"><FONT color=#000000>Live</FONT></A>

    <TD width="100%">

    </TR></TBODY></TABLE></TD></TR></TBODY></FORM></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
     
    cissss, Oct 31, 2007 IP
  2. Jamie18

    Jamie18 Peon

    Messages:
    201
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    it might have to do with not declaring the script type........

    try <script type="text/javascript">

    do you have the web developer toolbar? what error messages does it give you?
     
    Jamie18, Oct 31, 2007 IP
  3. cissss

    cissss Peon

    Messages:
    74
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    well,i tested it out

    firefox says the "form_search is not defined"

    it seems that if i followed the W3C sh!t,this define "name=form_search" can't get work on firefox.

    any idea?
     
    cissss, Nov 1, 2007 IP
  4. Jamie18

    Jamie18 Peon

    Messages:
    201
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    well... i took your code and massaged it a little bit to get this.. which works and validates 4.01strict
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    
    <html>
    <head>
    	<title>Search</title>
    	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    	<script type="text/javascript">
    		<!--
    		function searchjc()
    		{
    			var the_form = document.getElementById("form_search");
    			if(the_form.jcgoogle.checked)
    				window.open("http://www.google.com/search?hl=en&q="+the_form.key.value,"");
    			if(the_form.jclive.checked)
    				window.open("http://search.msn.com/results.aspx?q="+the_form.key.value,"");
    			if(the_form.jcyahoo.checked)
    				window.open("http://search.yahoo.com/search?p="+the_form.key.value,"");
    			return false;
    		}
    		//-->
    	</script>
    
    </head>
    
    <body>
    
    <table cellSpacing="0" cellPadding="0" style="background-color: #eaeaea; width: 100%;" border="0">
    	<tbody>
    		<tr>
    			<td>
    				<table cellSpacing="1" cellPadding="0" style="width: 100%;" border="0">
    					<tbody>
    						<tr>
    							<td>
    
    								<table cellSpacing="1" cellPadding="0" style="width: 100%;" border="0">
    									
    									<tbody>
    										<tr>
    											<td>
    											
    												<form id="form_search" action="">
    													<table cellSpacing="1" cellPadding="2" style="width: 100%;" border="0">
    														<tbody>
    															<tr>
    																<td style="width: 99%;">
    																	<input size="40" name="key">
    																	<input class="button" type="button" value="Search" name="submit" onclick="searchjc();"><br>
    																	<span class="style2">Web:</span>
    																	<input type="checkbox" checked="checked" value="google" name="jcgoogle">
    																	&nbsp;<a href="http://www.google.com/" style="color: #000000;">Google</a>
    																	<input type="checkbox" value="yahoo" name="jcyahoo">
    																	&nbsp;<a href="http://www.yahoo.com" style="color: #000000;">Yahoo</a>
    																	<input type="checkbox" value="live" name="jclive">
    																	&nbsp;<a href="http://www.live.com/" style="color: #000000">Live</a>
    																</td>
    															</tr>
    														</tbody>
    													</table>
    												</form>
    												
    											</td>
    										</tr>
    									</tbody>
    									
    								</table>
    								
    							</td>
    						</tr>
    					</tbody>
    				</table>
    				
    			</td>
    		</tr>
    	</tbody>
    </table>
    
    
    </body>
    </html>
    
    Code (markup):
    however, i'd rather help you put out something without all those unneccessary bulky tables floating around so i redid it for you and made it nice and clean.

    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    
    <html>
    <head>
    	<title>Search</title>
    	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    	<script type="text/javascript">
    		<!--
    		function searchjc()
    		{
    			var the_form = document.getElementById("form_search");
    			if(the_form.jcgoogle.checked)
    				window.open("http://www.google.com/search?hl=en&q="+the_form.key.value,"");
    			if(the_form.jclive.checked)
    				window.open("http://search.msn.com/results.aspx?q="+the_form.key.value,"");
    			if(the_form.jcyahoo.checked)
    				window.open("http://search.yahoo.com/search?p="+the_form.key.value,"");
    			return false;
    		}
    		//-->
    	</script>
    	<style type="text/css">
    		#container {
    			background-color: #eaeaea;
    			width: 99%;
    			padding: 5px;
    		}
    		#form_search {
    			margin: 0;
    		}
    	</style>
    </head>
    
    <body>
    
    <div id="container">
    	<form id="form_search" action="">
    		<div id="form_elements">
    			<input size="40" name="key">
    			<input class="button" type="button" value="Search" name="submit" onclick="searchjc();"><br>
    			<span class="style2">Web:</span>
    			<input type="checkbox" checked="checked" value="google" name="jcgoogle">
    			&nbsp;<a href="http://www.google.com/" style="color: #000000;">Google</a>
    			<input type="checkbox" value="yahoo" name="jcyahoo">
    			&nbsp;<a href="http://www.yahoo.com" style="color: #000000;">Yahoo</a>
    			<input type="checkbox" value="live" name="jclive">
    			&nbsp;<a href="http://www.live.com/" style="color: #000000">Live</a>
    		</div>
    	</form>
    </div>
    
    </body>
    </html>
    
    Code (markup):
     
    Jamie18, Nov 1, 2007 IP
  5. cissss

    cissss Peon

    Messages:
    74
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    wow``````

    i wanna give u a biiiiiiig thanks and a kiss if u want :)

    i think this

    ------
    var the_form = document.getElementById("form_search");
    ------

    helps me a lot

    thanks buddy
     
    cissss, Nov 2, 2007 IP
Thread Status:
Not open for further replies.