|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Load an Iframe using JS
Hello,
It's a simple problem to be honest but as I don't know much about Javascript, I'm stuck! Hopefully someone here can help me! Here goes... I have a media player in a pop-up window. The player uses flash and after each click on the play button, the flash document "pings" a function in a javascript file and assigns a few values to a variable called - myReturnArg I want one of the values in the array to be passed to a page in an iframe each time a track is played. This will allow me to update the database from the media player pop up window without having to reload the media player each time. At the moment, I have the document showing an alert box with all the info in the array. Basically, I need to take the MP3 file location which is in the array and pass it to the iframe which holds a php page. The php page then takes the value and uses it to search for and update the relevant row in a mysql DB. The media player popup php page uses the following code: Code:
js_wimpy_returnOnComplete = "myReturnFunction";
function myReturnFunction(myReturnArg){
alert ("Wimpy returned: " + myReturnArg + " \n\nBUMHOLE!");
if(typeof(myReturnArg) == "object"){
var returnedArray = myReturnArg;
var myAction = returnedArray.shift();
if(myAction == "wimpy_getTrackInfo"){
printReturnedData(myAction, returnedArray);
} else if (myAction == "wimpy_returnPlaylistItem"){
printReturnedData(myAction, returnedArray);
} else if (myAction == "wimpy_trackDone"){
printReturnedData(myAction, returnedArray);
} else if (myAction == "wimpy_trackStarted"){
printReturnedData(myAction, returnedArray);
function Add_Track_Play(track_ID) {
var iframe = document.getElementById("php_script");
if (!iframe) {
alert("Your browser doesn't support IFRAMEs. \n\nPlease use a supported browser to view this site such as FireFox.");
return false;
}
iframe.src = "(URL address blocked: See forum rules)="+track_ID;
return false;
}
Add_Track_Play(returnedArray[1]);
}
}
}
The popup page has an iframe like so: Code:
<iframe id="php_script" width="500" height="500"></iframe> Can you tell I don't know much about JavaScript?? I did manage to get the iframe to load a HTML page each time a track was played, however, once I tried to concatenate the info I needed, the page didn';t work any more. Any help whatsoever would be great as I'm up against the wall with this one. thanks David |
|
#2
|
||||
|
||||
|
i read through the code, i understand for the most part what your doing, can you please post how and what, in more detial, or just comented code?
comment tag for javascript is // per line thanks colton22
__________________
![]() Hang Out, Listen To Music, Have Fun, and Customize Your Experiance All In One Place! - Colton22's World - This is My World |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > Load an Iframe using JS |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|