PDA

View Full Version : changeable iframe content help



brent13a
04-27-2005, 01:10 AM
I like the script for this scrollable content iframe- http://www.dynamicdrive.com/dynamicindex11/scrollc2.htm I also have a script that I use on my website that is a 2 level combo box- http://javascriptkit.com/script/cut183.shtml how do I make it so that when I make a choice with the combbox then the content of the scrollable iframe changes to correspond?
thanks

jscheuer1
04-27-2005, 10:41 AM
You should use this scrolling content script instead:

http://www.dynamicdrive.com/dynamicindex17/iframescroll.htm

you can substitute those cool looking arrows for the up/down words if you like, so it will look exactly the same. Then in that script from JavascriptKit, replace this line:


location=temp.options[temp.selectedIndex].valuewith these lines:


if (document.getElementById)
document.getElementById('datamain').src=temp.options[temp.selectedIndex].value
else if (document.all)
document.all('datamain').src=temp.options[temp.selectedIndex].value

brent13a
04-27-2005, 06:40 PM
thanks a lot i'm going to try that but I am not going to be puting an actual page in the frame just text.........can i just upload a .txt file and put the iframe code (that is required from the scipt) at the bottom of the text file?
OR whatabout just keeping the javascriptkit script for changing conent and making the page into a split frame? would that work better & if so how might i implement that?
(I really appreciate all of your help)

brent13a
04-27-2005, 06:54 PM
thanks a lot i'm going to try that but I am not going to be puting an actual page in the frame just text.........can i just upload a .txt file and put the iframe code (that is required from the scipt) at the bottom of the text file?
OR whatabout just keeping the javascriptkit script for changing conent and making the page into a split frame? would that work better & if so how might i implement that?
(I really appreciate all of your help)I think this script would work best <iframe name="cwindow" style="border:2px solid black" width=150 height=150 src="doc.htm"></iframe> http://www.dynamicdrive.com/dynamicindex8/miniwindow.htm so can i adopt the dropdown boxes be adapted to this script?

jscheuer1
04-27-2005, 08:24 PM
Yes, just add id="datamain" to the iframe tag.

brent13a
04-27-2005, 08:52 PM
so the frame script would be:
<iframe id=datamain name="cwindow" style="border:2px solid black" width=150 height=150 src="doc.htm"></iframe>
and
I would replace:
location=temp.options[temp.selectedIndex].value (from: http://javascriptkit.com/script/cut183.shtml )
with:
if (document.getElementById)
document.getElementById('datamain').src=temp.options[temp.selectedIndex].value
else if (document.all)
document.all('datamain').src=temp.options[temp.selectedIndex].value

correct?

what about thi statement from the iframe script page:
-Notice the "name=cwindow" attribute inside the above code....you'll need this if you wish to create a link outside the mini window that loads the target url inside the mini-window. For example:
<a href="minidoc.htm" target="cwindow">

jscheuer1
04-28-2005, 01:42 AM
Yes and, what about it? To elaborate, id="datamain" is more correct than id=datamain but either should work, that part about name="cwindow" is irrelevant to the JavascriptKit script but, will work as promised on the DD demo page for an ordinary link.