Scripting Help

  • ukshopsnet
  • Novice
  • Novice
  • ukshopsnet
  • Posts: 21
  • Loc: HIGH PEAK, UK

Post 3+ Months Ago

Hi

I have some cut & paste code from Affiliate Future for a search box. The JavaScript at the beginning of the code makes the search results open up in a new window. I do not want this to happen... I want the search results to open in the same page i.e. so the page refreshes and displays the results in the same browser window. Question is how do I modify the script so it does this????

Cheers in advance
Phil

Code: [ Select ]
<script language="JavaScript">
var query;
function SearchDeepfeeds()
{
var w;
w=window.open('http://s.afnt.co.uk/search.aspx?a=286&q=' + query,'deepfeed',
'width=518,height=450,resizable=yes,scrollbars=yes,location=no,toolbar=no');w.focus()
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td bgcolor="#d7ddfd">
<img src="http://s.afnt.co.uk/img/search-big-blue.gif"><br>
<span style="FONT-SIZE: 8pt; COLOR: #031884; FONT-FAMILY: Arial">
1000s of searchable products</span><br>
<INPUT style="FONT-SIZE: 11px; WIDTH: 100px" type="text" onkeyup="if(event.keyCode==13){query=this.value;SearchDeepfeeds()};" onchange="query=this.value" name="DeepFeedSearch"><a href=# onclick="SearchDeepfeeds();"><img height="18" border="0" align="absMiddle" src="http://s.afnt.co.uk/img/go-blue.gif" width="33"></a>
</td>
</tr>
</table>
  1. <script language="JavaScript">
  2. var query;
  3. function SearchDeepfeeds()
  4. {
  5. var w;
  6. w=window.open('http://s.afnt.co.uk/search.aspx?a=286&q=' + query,'deepfeed',
  7. 'width=518,height=450,resizable=yes,scrollbars=yes,location=no,toolbar=no');w.focus()
  8. }
  9. </script>
  10. <table width="100%" border="0" cellspacing="0" cellpadding="5">
  11. <tr>
  12. <td bgcolor="#d7ddfd">
  13. <img src="http://s.afnt.co.uk/img/search-big-blue.gif"><br>
  14. <span style="FONT-SIZE: 8pt; COLOR: #031884; FONT-FAMILY: Arial">
  15. 1000s of searchable products</span><br>
  16. <INPUT style="FONT-SIZE: 11px; WIDTH: 100px" type="text" onkeyup="if(event.keyCode==13){query=this.value;SearchDeepfeeds()};" onchange="query=this.value" name="DeepFeedSearch"><a href=# onclick="SearchDeepfeeds();"><img height="18" border="0" align="absMiddle" src="http://s.afnt.co.uk/img/go-blue.gif" width="33"></a>
  17. </td>
  18. </tr>
  19. </table>
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Here's what causes it:

Code: [ Select ]
{
var w;
w=window.open('http://s.afnt.co.uk/search.aspx?a=286&q=' + query,'deepfeed', 'width=518,height=450,resizable=yes,scrollbars=yes,location=no,toolbar=no');w.focus()
}
  1. {
  2. var w;
  3. w=window.open('http://s.afnt.co.uk/search.aspx?a=286&q=' + query,'deepfeed', 'width=518,height=450,resizable=yes,scrollbars=yes,location=no,toolbar=no');w.focus()
  4. }


the window.open is what causes it to open in a new window. Unfortunately, I don't know how to fix it, without a rewrite of that part of the code. There are others here better with javascript than I am that may be able to help so stay tuned.
  • RichB
  • Guru
  • Guru
  • User avatar
  • Posts: 1121
  • Loc: Boston

Post 3+ Months Ago

Try adding:
Code: [ Select ]
self.name="deepfeed";


just above

Code: [ Select ]
var query;


if your window has the same name as the window that is in the pop open code it will open in the same window rather than creating a new one.
  • ukshopsnet
  • Novice
  • Novice
  • ukshopsnet
  • Posts: 21
  • Loc: HIGH PEAK, UK

Post 3+ Months Ago

Hi

You are a star! :D

It works and here it is working - http://www.findshops.net

Cheers
Phil
  • RichB
  • Guru
  • Guru
  • User avatar
  • Posts: 1121
  • Loc: Boston

Post 3+ Months Ago

Looks good. I'm glad it worked out for you. :D
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Nicely done RichB - I seriously need to take the time to actually learn javascript rather than just playing around with it. Your work impresses me.
  • RichB
  • Guru
  • Guru
  • User avatar
  • Posts: 1121
  • Loc: Boston

Post 3+ Months Ago

Thanks. I've really gotten to like javascript. If it weren't for the stupid browser incompatibilities with the advanced techniques I think I'd love it.

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 147 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.