PDA

View Full Version : I-Frame external file access



dorunrun
04-17-2008, 10:31 PM
1) Script Title: IFRAME scroller

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex2/iframe-scroller.htm

3) Describe problem: Does the exteranl file the script accesses HAVE to be named "external." If I change the file name all I get is a white box-no scrolling content.

Any help or ideas would be greatly appreciated. Just found DD but finding lots to look at
Thanks
Kevin

Nile
04-17-2008, 10:36 PM
It doesn't have to be named that, but then in the javascript, where it says:


//specify path to your external page:
var iframesrc="external.htm"

Would have to be changed, so change the highlighted to the file name.
This is very simple. You can also make nemerous scollers by chaning your js to this:


<script type="text/javascript">

/***********************************************
* IFRAME Scroller script- Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

//specify path to your external page:
var iframesrc= new Array();
var iframesrc = ["page1.html","page2.html"] //and then keep going with the same patern, you can change file name.
for(i=0;i<=iframesrc.length-1;i++){
//You may change most attributes of iframe tag below, such as width and height:
document.write('<iframe id="datamain" src="'+iframesrc[i]+'" width="150px" height="150px" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="1" scrolling="no"></iframe>');
}
</script>
I Hope this Helps,
Nile

Jfis
04-17-2008, 10:39 PM
I am guessing but if you changed the name of the external file did you also make the name change in the code you inserted in the page to load the iframe?

<script type="text/javascript">

/***********************************************
* IFRAME Scroller script- Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

//specify path to your external page:
var iframesrc="external.htm"

//You may change most attributes of iframe tag below, such as width and height:
document.write('<iframe id="datamain" src="'+iframesrc+'" width="150px" height="150px" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="1" scrolling="no"></iframe>')

</script>

You would have to change the var iframesrc to the proper name to match your new one.

Jfis
04-17-2008, 10:41 PM
Haha beat me to it.

Nile
04-17-2008, 10:41 PM
I beat you to it :p. And also in the future when your putting codes down, use:

and To make it look neater, It also helps us seperate text from code.

Jfis
04-17-2008, 10:43 PM
Will do thanks!

dorunrun
04-17-2008, 11:17 PM
Thanks everyone for some reason the text was not showing up in Frontpage preview but when i opened in IE it was fine. If anyone knows why that happens I would be interested though
Kevin