Yea! Now after years of applications work I have finally bit the bullet and gotten myself a website playground. But I am running into a problem. I want to be able to make some money off this site when a user wants to search for something. So I set up google to be my search engine of choice and whenever someone searches something google populates a div in my search.php with the information returned from their servers. Here is what the code looks like:
[CODE=javascript]
<div id="googleSearc hUnitIframe">&n bsp;</div>
<script type="text/javascript">
var winW = 630;//default
if (parseInt(navig ator.appVersion )>3) {
if (navigator.appN ame=="Netscape" ) {
winW = window.innerWid th;
}
if (navigator.appN ame.indexOf("Mi crosoft")!=-1) {
winW = document.body.o ffsetWidth;
}
}
var googleSearchIfr ameName = 'googleSearchUn itIframe';
var googleSearchFra meWidth = winW * .76;
var googleSearchFra meborder = 0 ;
var googleSearchDom ain = 'www.google.com ';
</script> <script type="text/javascript"
src="http://www.google.com/afsonline/show_afs_search .js">
</script></div>[/CODE]
As you can see I create a blank div called googleSearchUni tIframe that google then puts its information in. I also specify the framewidth and frameborder which I try to do dynamically whenever the page loads (well not the border). My nav bar is on the right that is why the width needs to be multiplied by .76.
This little javascript actually works great, but what I am trying to do is handle if/when the user wants to resize their browser window. At this point the google frame will stay the same size and everything will resize behind it. I want to make it so that the googleSearchFra meWidth will be recalculated everytime the user presses F5(which it does now) or resizes the window(which it does not do now). It may require the page to be reloaded whenever the window is resized, that is fine. I don't mind a google search request being resent everytime the window is resized.
What c0dez r ur going to give me to m4ke it werk?!?!?!1!!11 eleven!! Need help plz pzl plzzzzzz.
[CODE=javascript]
<div id="googleSearc hUnitIframe">&n bsp;</div>
<script type="text/javascript">
var winW = 630;//default
if (parseInt(navig ator.appVersion )>3) {
if (navigator.appN ame=="Netscape" ) {
winW = window.innerWid th;
}
if (navigator.appN ame.indexOf("Mi crosoft")!=-1) {
winW = document.body.o ffsetWidth;
}
}
var googleSearchIfr ameName = 'googleSearchUn itIframe';
var googleSearchFra meWidth = winW * .76;
var googleSearchFra meborder = 0 ;
var googleSearchDom ain = 'www.google.com ';
</script> <script type="text/javascript"
src="http://www.google.com/afsonline/show_afs_search .js">
</script></div>[/CODE]
As you can see I create a blank div called googleSearchUni tIframe that google then puts its information in. I also specify the framewidth and frameborder which I try to do dynamically whenever the page loads (well not the border). My nav bar is on the right that is why the width needs to be multiplied by .76.
This little javascript actually works great, but what I am trying to do is handle if/when the user wants to resize their browser window. At this point the google frame will stay the same size and everything will resize behind it. I want to make it so that the googleSearchFra meWidth will be recalculated everytime the user presses F5(which it does now) or resizes the window(which it does not do now). It may require the page to be reloaded whenever the window is resized, that is fine. I don't mind a google search request being resent everytime the window is resized.
What c0dez r ur going to give me to m4ke it werk?!?!?!1!!11 eleven!! Need help plz pzl plzzzzzz.
Comment