cloudy

Author Topic: Linking Into An Iframe on Another Page  (Read 1218 times)

0 Members and 1 Guest are viewing this topic.

Offline drobbins

  • Posts: 1,615
  • Kentucky, USA
    • Cave Country Weather
Linking Into An Iframe on Another Page
« on: August 01, 2010, 06:34:34 PM »
I have a simple script that will get the NWS forecast for any zip code and it opens it in a new tab. I would like it to open in an iframe on another page with in my website. I have come close, but not quite all the way yet. This will enter the forecast in an iframe on the same page as the input form.
http://www.cavecountryweather.com/wxsearch.php

How can it load onto this page from the form on the menubar?
Also, why is the iframe not centered?
« Last Edit: August 02, 2010, 11:08:37 PM by drobbins »

Offline drobbins

  • Posts: 1,615
  • Kentucky, USA
    • Cave Country Weather
Re: Linking Into An Iframe on Another Page
« Reply #1 on: August 02, 2010, 11:07:00 PM »
After trying many things, I found the solution on another forum.  :roll: :oops:
In the menubar.php, this is input:
Code: [Select]
<p class="sideBarTitle">Forecast Search</p>
<table align="center" cellspacing="0" cellpadding="2" border="0" width="90">
<tr>
<td align="center" colspan="2">Find Your Local NWS Forecast By<br />
</td>
</tr>
<tr align="center" valign="top">
<td class="searchinput">
<form method="post" action="wxsearch.php">
<input type="text" name="where" size="11" value="City, St or Zip" onfocus="this.value='';" />
<input type="submit" name="Go2" value="Go" />
</form>

</td>
</tr>
</table>

Then on a page named wxsearch.php:
Code: [Select]
<iframe src="http://www.srh.noaa.gov/zipcity.php?inputstring=<?php echo $_POST["where"]; ?>"
       name="frame1" frameborder="0" width="700" height="1550">
  <p>Your browser does not support iframes.</p>
</iframe>
This allows visitors to get any NWS forecast with out leaving my site.  :wink:

Offline ALITTLEweird1

  • Mark
  • Posts: 3,984
  • Snoqualmie,WA
    • Snoqualmie Weather
Re: Linking Into An Iframe on Another Page
« Reply #2 on: August 06, 2010, 02:24:58 AM »
I have the code working but, now i cant get my index page to validate with it in my menu bar.


Got it to validate. Thanks for the script.
« Last Edit: August 06, 2010, 03:02:45 AM by ALITTLEweird1 »
"Nature can do without man, but man cannot do without nature."

Davis VP2 + 1-Wire Solar + 1-wire Lightning + 1-Wire UV + Logitech Webcam

Offline drobbins

  • Posts: 1,615
  • Kentucky, USA
    • Cave Country Weather
Re: Linking Into An Iframe on Another Page
« Reply #3 on: August 07, 2010, 12:57:12 PM »
Your welcome  :wink:
I noticed that the input box is a little wider than your menubar. Find this line:
Code: [Select]
<input type="text" name="where" size="11" value="City, St or Zip" onfocus="this.value='';" />
Change the size="11" to what ever width works for your site.

I should start a new thread with a better title to share this one.
Dave

Offline ALITTLEweird1

  • Mark
  • Posts: 3,984
  • Snoqualmie,WA
    • Snoqualmie Weather
Re: Linking Into An Iframe on Another Page
« Reply #4 on: August 08, 2010, 09:19:22 PM »
Hmm.. I don't see that on my screen. Wonder If its cause Im using a higher resolution. 1280*960   :dontknow:
"Nature can do without man, but man cannot do without nature."

Davis VP2 + 1-Wire Solar + 1-wire Lightning + 1-Wire UV + Logitech Webcam

Offline drobbins

  • Posts: 1,615
  • Kentucky, USA
    • Cave Country Weather
Re: Linking Into An Iframe on Another Page
« Reply #5 on: August 08, 2010, 10:22:02 PM »
It is a FF - IE thing.  :roll: Looks OK in IE, but this is what it looks like in FF.  :?

Offline ALITTLEweird1

  • Mark
  • Posts: 3,984
  • Snoqualmie,WA
    • Snoqualmie Weather
Re: Linking Into An Iframe on Another Page
« Reply #6 on: August 08, 2010, 10:58:07 PM »
Oh..Ok.... Thanks for the heads up on that. I only use IE.
"Nature can do without man, but man cannot do without nature."

Davis VP2 + 1-Wire Solar + 1-wire Lightning + 1-Wire UV + Logitech Webcam

Offline drobbins

  • Posts: 1,615
  • Kentucky, USA
    • Cave Country Weather
Re: Linking Into An Iframe on Another Page
« Reply #7 on: August 08, 2010, 11:04:38 PM »
I only use FF :lol:  I thought that validating was supposed to ensure that the page looks the same in all browsers.  :?

Offline jjmcnelly

  • Posts: 263
  • Napavine, WA
    • Cedar Ridge Weather Station, Napavine WA 98565
Re: Linking Into An Iframe on Another Page
« Reply #8 on: August 08, 2010, 11:38:16 PM »
How do I get the forecast to appear at the top of the page instead of way down?  I am using IE.

I only use FF :lol:  I thought that validating was supposed to ensure that the page looks the same in all browsers.  :?

Offline ALITTLEweird1

  • Mark
  • Posts: 3,984
  • Snoqualmie,WA
    • Snoqualmie Weather
Re: Linking Into An Iframe on Another Page
« Reply #9 on: August 08, 2010, 11:45:13 PM »
Looks good here.. Running IE8
"Nature can do without man, but man cannot do without nature."

Davis VP2 + 1-Wire Solar + 1-wire Lightning + 1-Wire UV + Logitech Webcam

Offline jjmcnelly

  • Posts: 263
  • Napavine, WA
    • Cedar Ridge Weather Station, Napavine WA 98565
Re: Linking Into An Iframe on Another Page
« Reply #10 on: August 08, 2010, 11:56:15 PM »
Looks fine on my W7 computer using IE8, but doesn't on my XP laptop using IE....?  :?

Looks good here.. Running IE8

Offline jjmcnelly

  • Posts: 263
  • Napavine, WA
    • Cedar Ridge Weather Station, Napavine WA 98565
Re: Linking Into An Iframe on Another Page
« Reply #11 on: August 09, 2010, 12:04:32 AM »
What code did you use to add the "NEW" Graphic.?  I am not sure exactly how to make it happen.   :oops:

It is a FF - IE thing.  :roll: Looks OK in IE, but this is what it looks like in FF.  :?

Offline ALITTLEweird1

  • Mark
  • Posts: 3,984
  • Snoqualmie,WA
    • Snoqualmie Weather
Re: Linking Into An Iframe on Another Page
« Reply #12 on: August 09, 2010, 12:09:02 AM »
I have 1 pc using Win 7 and one using XP Pro.. I looked at your site with both PC's, and it looks good. The forecast is at the top of the page.

What code did you use to add the "NEW" Graphic.?  I am not sure exactly how to make it happen.   :oops:

Here's the whole script Im using in my menubar to show where I have the new.gif placed. It does validate.

Code: [Select]

<p class="sideBarTitle">Forecast Search<img src="new.gif" alt=""/></p>
<table align="center" cellspacing="0" cellpadding="2" border="0" width="90">
<tr>
<td align="center" colspan="2">Find Your Local NWS Forecast By<br />
</td>
</tr>
<tr align="center" valign="top">
<td class="searchinput">
<form method="post" action="wxsearch.php">
<input type="text" name="where" size="11" value="City, St or Zip" onfocus="this.value='';" />
<input type="submit" name="Go2" value="Go" />
</form>
</td>
</tr>
</table>


"Nature can do without man, but man cannot do without nature."

Davis VP2 + 1-Wire Solar + 1-wire Lightning + 1-Wire UV + Logitech Webcam

Offline ALITTLEweird1

  • Mark
  • Posts: 3,984
  • Snoqualmie,WA
    • Snoqualmie Weather
Re: Linking Into An Iframe on Another Page
« Reply #13 on: August 09, 2010, 12:22:48 AM »
I just looked at your search forecast page on IE7, and See what your talking about it being pushed to the bottom. Try adjusting the width in these settings. I had to mess with these also.

<iframe src="http://www.srh.noaa.gov/zipcity.php?inputstring=<?php echo $_POST["where"]; ?>"
       name="frame1" frameborder="0" width="673" height="1550">
  <p>Your browser does not support iframes.</p>
</iframe>
"Nature can do without man, but man cannot do without nature."

Davis VP2 + 1-Wire Solar + 1-wire Lightning + 1-Wire UV + Logitech Webcam

Offline jjmcnelly

  • Posts: 263
  • Napavine, WA
    • Cedar Ridge Weather Station, Napavine WA 98565
Re: Linking Into An Iframe on Another Page
« Reply #14 on: August 09, 2010, 01:10:15 AM »
Got it!!!!

Thanks :D

I have 1 pc using Win 7 and one using XP Pro.. I looked at your site with both PC's, and it looks good. The forecast is at the top of the page.

Here's the whole script Im using in my menubar to show where I have the new.gif placed. It does validate.

Code: [Select]

<p class="sideBarTitle">Forecast Search<img src="new.gif" alt=""/></p>
<table align="center" cellspacing="0" cellpadding="2" border="0" width="90">
<tr>
<td align="center" colspan="2">Find Your Local NWS Forecast By<br />
</td>
</tr>
<tr align="center" valign="top">
<td class="searchinput">
<form method="post" action="wxsearch.php">
<input type="text" name="where" size="11" value="City, St or Zip" onfocus="this.value='';" />
<input type="submit" name="Go2" value="Go" />
</form>
</td>
</tr>
</table>




I'll mess with it.  Thanks!
I just looked at your search forecast page on IE7, and See what your talking about it being pushed to the bottom. Try adjusting the width in these settings. I had to mess with these also.

<iframe src="http://www.srh.noaa.gov/zipcity.php?inputstring=<?php echo $_POST["where"]; ?>"
       name="frame1" frameborder="0" width="673" height="1550">
  <p>Your browser does not support iframes.</p>
</iframe>

« Last Edit: August 09, 2010, 01:11:59 AM by jjmcnelly »