Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Oct 2006
    Location
    Worthing, South coast of England
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Help with Targets

    Hi, I have a website which i recently added a search to, i purchased a piece of software to create the search for me to save me time with the indexing. The search its self works fine and all has been ok. Until now i have had the search simply on the side of the site, now i want to put it in an iFrame my problem is that i cannot seem to select a target for the submit button so that it opens in the whole page (_top). I have emailed the company that made the software, they replied explaining how to do this using the software.... doesn't seem to work (either that or im just too stupid to work it out :P).

    Here is the code im using for the search:
    <FORM name="formSear" action="../search.html" method="GET" onSubmit="return qs();" style="margin-bottom: 0" target="_top">

    <script>
    function qs(){var f=document.formSear;var qe=f.searWords.value;if(window.encodeURIComponent)qe=encodeURIComponent(qe);if(f.area)if(f.area.valu e==2){document.location="http://www.google.com/search?q="+qe;return false;}var pt=document.location.href;var iq=pt.indexOf('?');if(iq!=-1)pt=pt.substring(0, iq);if(f.action)if(f.action!="")pt=f.action;var ue=pt+"?searWords="+qe;if(f.search)ue+="&search="+f.search.value;if(f.match)ue+="&match="+f.match.va lue;document.location=ue;return false;}
    </script>
    <font size="1">
    <INPUT name="searWords" style="font-family: Verdana; font-size: 10px" size="16"">
    </font>
    <INPUT name="Send" type="submit" value="Search" style="font-family: Verdana; font-size: 10px">
    </FORM>

    Sorry its a bit messy
    So is there a way that this code can be edited to make it open in the whole page not just in the small iFrame?

    Any ideas or help would be really appreciated

    Thank you for your time

    Daniel Westwater
    Last edited by n0z^; 10-13-2006 at 04:04 PM.

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Code:
    <FORM name="formSear" action="../search.html" method="GET" onSubmit="return qs();" style="margin-bottom: 0" target="_top">
    
    <script>
    function qs(){var f=document.formSear;var qe=f.searWords.value;if(window.encodeURIComponent)qe=encodeURIComponent(qe);if(f.area)if(f.area.valu e==2){document.location="http://www.google.com/search?q="+qe;return false;}var pt=document.location.href;var iq=pt.indexOf('?');if(iq!=-1)pt=pt.substring(0, iq);if(f.action)if(f.action!="")pt=f.action;var ue=pt+"?searWords="+qe;if(f.search)ue+="&search="+f.search.value;if(f.match)ue+="&match="+f.match.va lue;document.location=ue;return false;}
    </script>
    <font size="1">
    <INPUT name="searWords" style="font-family: Verdana; font-size: 10px" size="16"">
    </font>
    <INPUT name="Send" type="submit" value="Search" style="font-family: Verdana; font-size: 10px">
    </FORM>
    Code:
    <FORM name="formSear" action="../search.html" method="GET" onSubmit="return qs();" style="margin-bottom: 0" target="_top">
    
    <script>
    function qs(){var f=document.formSear;var qe=f.searWords.value;if(window.encodeURIComponent)qe=encodeURIComponent(qe);if(f.area)if(f.area.valu e==2){parent.frames['youriframename'].location="http://www.google.com/search?q="+qe;return false;}var pt=parent.frames['youriframename'].location.href;var iq=pt.indexOf('?');if(iq!=-1)pt=pt.substring(0, iq);if(f.action)if(f.action!="")pt=f.action;var ue=pt+"?searWords="+qe;if(f.search)ue+="&search="+f.search.value;if(f.match)ue+="&match="+f.match.va lue;document.location=ue;return false;}
    </script>
    <font size="1">
    <INPUT name="searWords" style="font-family: Verdana; font-size: 10px" size="16"">
    </font>
    <INPUT name="Send" type="submit" value="Search" style="font-family: Verdana; font-size: 10px">
    </FORM>
    Change the parts in bold to match the parts in bold of the second form. You do know you can get a custom form for your site without using js? http://www.google.com/services/free.html
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    New to the CF scene
    Join Date
    Oct 2006
    Location
    Worthing, South coast of England
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for you quick reply, i do realise that you can get a google search for free but it includes all the google brand images and ad's i believe and as this is for a company site i do not think it is appropriate

    Thanks
    Sometimes you think that something is something when something is nothing, all i would need you to do is explain to me what sometimes is when sometimes is either nothing or something?? <--- Its strange what come out when you just let your fingers type without thinking

  • #4
    New to the CF scene
    Join Date
    Oct 2006
    Location
    Worthing, South coast of England
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation

    I have just tryed the code that you supplied, entering in the iFrame name but it doesnt seem to have worked, im sure it must be something that i am doing wrong as i doubt the code you gave me is wrong.
    You can look for yourself, the page is...

    http://www.etiltd.co.uk/index1.htm
    http://www.etiltd.co.uk/frames/sideframe.htm

    I know that the code is a mess as the page has been done in frontpage (made before i joined the company :P)
    Im sure its just something simple, but i have got to the point of pulling my hair out with this thing! Therfore probably missing a simple mistake.

    Thanks

    Dan
    Sometimes you think that something is something when something is nothing, all i would need you to do is explain to me what sometimes is when sometimes is either nothing or something?? <--- Its strange what come out when you just let your fingers type without thinking

  • #5
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You need to change it to I1 not I2 and there is one more part you need to change that I missed earlier.
    Code:
    if(f.match)ue+="&match="+f.match.value;document.location=ue;return false;}</script>
    Code:
    if(f.match)ue+="&match="+f.match.value;parent.frames['I1'].location=ue;return false;}</script>
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #6
    New to the CF scene
    Join Date
    Oct 2006
    Location
    Worthing, South coast of England
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks again for another quick reply! I have now done as you have said, problem is that it now opens in the top iFrame. (the one with the banner and navBar in) I really don't mean to be a bother and do feel rude keep replying back when its not working. I am very greatfull for your help so far. The thing is that i want it to open up in the whole page... not in an iFrame. As explained in my first post, the search is in an iFrame but i want the link, like the others on the side bar to open in the whole page.
    This would be done in HTML by simply adding [target="_top"] to the link. i have been able to do this also with the dropdown box which caused a few problems but i got there in the end. I thought that getting the search to do the same would be far more simple... how wrong was I :/

    Thanks again

    Dan
    Sometimes you think that something is something when something is nothing, all i would need you to do is explain to me what sometimes is when sometimes is either nothing or something?? <--- Its strange what come out when you just let your fingers type without thinking

  • #7
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Okay so you want it to open in the iframe next to it where the content is at or you just want it to be its own page? If you want it to be its own page try
    Code:
    parent.location
    instead of
    Code:
    parent.frames['youriframename'].location
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #8
    New to the CF scene
    Join Date
    Oct 2006
    Location
    Worthing, South coast of England
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You got it!

    I am so greatfull for your help. Stress over! I will be straight over to the nomination page to post how helpfull you have been. Im so glad that you have replyed so quickly as im out of the office in 10mins and it would have meant that the site would have had a dodgy search that didnt work on it all over the weekend, and as the site is very busy and has alot of traffic it probably would have cost a bit in loss of sales!

    Just looked at the Nomination page... looks like you have many fans here!

    Thank You so very much

    Dan
    Last edited by n0z^; 10-13-2006 at 05:29 PM.
    Sometimes you think that something is something when something is nothing, all i would need you to do is explain to me what sometimes is when sometimes is either nothing or something?? <--- Its strange what come out when you just let your fingers type without thinking


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •