Link to home
Start Free TrialLog in
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
Avatar of leakim971
leakim971
Flag of Guadeloupe image

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.
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 :)
Avatar of Tom Powers
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.
ASKER CERTIFIED SOLUTION
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Straightforward advice. Thanks Bro
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
<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