...

View Full Version : How do I modify search facility code to open in a new window?



metamuse
05-07-2007, 07:03 PM
Hello,

I'm currently working on a website which needs to integrate some search facility code that the client has supplied to me. However, the code I've been given was designed to be intergrated into a site built using a frameset (which mine isn't) and I'd like to modify it so that instead of loading the results in a frameset, they open in a new window. Could someone please take a look at the instructions and code below and tell me if this is possible?

Thanks!


1. Add the following javascript to the <head> of your page (please call
your CSR to get your client no. in order to replace it in the javascript):


<script type="text/javascript">
function RefreshFrame( pFrameId ) {
document.target = pFrameId;
var wController =
'http://www.powersourceonline.com/cgi/en/vstock.search/';
var wSearchString = document.getElementById( 'SearchBox' ).value;
var wClientNoString = "123456";
document.location = wController + wSearchString + '-' +
wClientNoString + '-br';
}
</script>

2. Add the following <form> to your page:


<form method="post" id="Search"
action="javascript:RefreshFrame('SearchFrame')">
<span>Part Number</span>
<input id="SearchBox" name="SearchRequest.QueryCriteria.SingleBox"
size="30" type="text" value="" />
<input type="submit" value="Go" />
</form>

3. Add the following <frame> to your page:

<frame id="SearchFrame"
src="http://www.powersourceonline.com/cgi/en/vstock.search">

Note:
You can implement the frameset to your liking but the frame containing the VStock Search results, should never be less than 760 pixels wide, it is the minimum.

antimatter15
05-07-2007, 08:40 PM
<script type="text/javascript">
function RefreshFrame(unusedarguement) {
var wController =
'http://www.powersourceonline.com/cgi/en/vstock.search/';
var wSearchString = document.getElementById( 'SearchBox' ).value;
var wClientNoString = "123456";
var fullsearchurlstring = "";
document.location = wController + wSearchString + '-' + wClientNoString + '-br';
window.open(fullsearchurlstring,'SearchResponse');
}
</script>

just replace the first javascript code with this and it should work

metamuse
05-08-2007, 08:37 PM
Hello,

Thanks for your help so far - it's much appreciated. I uploaded a test page to try it out: http://www.pixeldom.co.uk/projects/laptopspares/search.html

It does load a new page which is great (a big step forward) but the results don't appear in it and I get an 'unable to process request' message. Do you have any suggestions?

Thanks again!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum