View Full Version : just confused really

07-05-2005, 05:54 PM
ok im trying to get to know web design/ coding and have just started looking at javascript i have looked at a few tutorials and looked at a few sites source containing javascript..
i tried to recreate a simple enough search box which has a query box then you click which site to search and then the submit button which then loads the search page in a frame beside the box but when i recreated it and clicked submit there was an error

'parent.frames.1.location' is null or not an object

i dont have any additional frames added on the page and would like to know what i should do and what the parent.frame.1 is

any help is much appreciated

below is the code i have so fa... very simple

<script language="Javascript" type="text/javascript">
function search()
if (document.f.q.value == "")
var URL;
if (document.f.engine[0].checked) { URL = "http://www.google.com/" }
if (document.f.engine[1].checked) { URL = "http://www.msn.co.uk/" }
var URL;
if (document.f.engine[0].checked) { URL = "http://www.google.co.uk/search?hl=en&q=" + document.f.q.value; }
if (document.f.engine[1].checked) { URL = "http://search.msn.co.uk/results.aspx?FORM=MSNH&CP=1252&q=" + document.f.q.value; }

<body onload="javascript:document.f.q;">

<form action="javascript:search();" name="f"><br>
<input name="q" style="width: 140px;" type="text">
<input name="engine" value="1" class="blank" type="radio" checked="checked" id="s1"><label for="s1"> Google</label><br>
<input name="engine" value="2" class="blank" type="radio" id="s2"><label for="s2"> MSN</label><br>

<input value="Torrent Search" class="flat-button" style="position: relative; top: 5px; width: 90px;" type="submit">


Mr J
07-05-2005, 11:05 PM
Change the 2 instances of this line


to this


Also take out the


from the opening BODY tag

You could also take out the second

var URL;

and put the first before the function line