Avatar of Tom Powers
Tom Powers
 asked on

Pass game id into 5 Iframe pages is it possible

I can pass a game id into a page and that page displays perfectly now  I was wondering if I could pass that game id into a IFrame page with 5 I frames that need that game id

This is Web page with 5 IFRAME PAGES
http://dev.sportsnetwork.com/aspdata/nba2/NbaGamecast1.html?gameID=18434 


BUT in the Iframe IF I  hardcode a value like

<iframe width='100%' height='400' scrolling='no' frameborder='no' src='http://dev.sportsnetwork.com/aspdata/NBA2/Court4.html?gameID=18434'> </iframe> IT WORKS .


Can I create or use a variable that will work outside the javascript tags. Thanks EE
JavaScriptjQueryXML

Avatar of undefined
Last Comment
leakim971

8/22/2022 - Mon
leakim971

You should consider Iframe like new browser tab or popup. An Iframe is like a page inside a page. The url in the browser bar is the value of the SRC attribute.
Chris Stanyon

Hey Tom,

Having problems loading your page so can't see what you've done. But here's some idea of what I'd do. The more you need to rely on dynamic data the more reason there is to switch to using a server-side scripting language such as PHP or ASP. It make sense to start using that earlier rather than later, so you don't need to change everything a few months down the line.

If you were using PHP for example (my scripting language of choice), then it would be simple. First you'd grab the gameID from the query string (the bit in the URL after the question mark):

<?php $gameID = $_GET['gameID']; ?>

Open in new window

Then for each iFrame, you'd just echo (output) the $gameID variable wherever you need it:

<iframe width='100%' height='400' scrolling='no' frameborder='no' src='http://dev.sportsnetwork.com/aspdata/NBA2/Court4.html?gameID=<?php echo $gameID ?>'> </iframe>

<iframe width='100%' height='400' scrolling='no' frameborder='no' src='someOtherPage.html?gameID=<?php echo $gameID ?>'> </iframe>

<iframe width='100%' height='400' scrolling='no' frameborder='no' src='anotherPage.html?gameID=<?php echo $gameID ?>'> </iframe>

Open in new window

Pretty much every application on the web these days is built using Server-Side scripting, so sooner or later you will need to embrace it :)
Tom Powers

ASKER
Chris we don't have any php framework installed Is that what you need to use php. We do have .net 2.0 and I can program in asp.net but for this case how do I do what you just did in PHP but do it in VB.NET OR C#. Preferably VB.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ASKER CERTIFIED SOLUTION
Chris Stanyon

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Tom Powers

ASKER
Straightforward advice. Thanks Bro
Tom Powers

ASKER
I wrote

 Sub Page_Load(Source As Object, E As EventArgs)

   Dim ID As String
   

   

            ID = Request.QueryString("gameID")
   END SUB

<iframe width='100%' height='175' scrolling='no' frameborder='no' src='http://dev.sportsnetwork.com/aspdata/NBA2/Nbastart1.html? & ID & '></iframe>


But it's not & or <% tried both. Please Help
leakim971

<iframe width='100%' height='175' scrolling='no' frameborder='no' src='http://dev.sportsnetwork.com/aspdata/NBA2/Nbastart1.html?gameID=<%= ID %>'></iframe>

Open in new window

⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.