PDA

View Full Version : IFRAME scroller IE: use inside table



FatCactus
09-14-2004, 10:13 AM
I'm a complete novice ... so apologies if this is a dumb question.

I've been trying out the IFRAME scroller IE

http://www.dynamicdrive.com/dynamicindex2/iframe-scroller.htm

and it works fine ... except when I try to insert the script into the cell of a table. When I view the page I just see the actual script commands and no scrolling text. I'd be very grateful if someone would tell me where I'm going wrong.

Thanks ...

ddadmin
09-15-2004, 09:37 PM
It shouldn't matter whether the script is inside a table cell or not. Do you have a URL to the problem?

FatCactus
09-16-2004, 10:38 AM
The links are:

Works - not inside table

http://www.liv.ac.uk/~jan/Test.htm

and

Doesn't work - inside table

http://www.liv.ac.uk/~jan/Test2.htm

Thanks for any help ...

cr3ative
09-16-2004, 02:26 PM
I viewed the source of the tabled site, this is what it says:



<table width="75%" border="1">
<tr>
<td>&lt;script type=&quot;text/javascript&quot;&gt;
<p>/***********************************************<br>

* IFRAME Scroller script- &copy; Dynamic Drive DHTML code library (www.dynamicdrive.com)<br>
* This notice MUST stay intact for legal use<br>
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source
code<br>
***********************************************/</p>
<p>//specify path to your external page:<br>

var iframesrc=&quot;external.htm&quot;</p>
<p>//You may change most attributes of iframe tag below, such as width and
height:<br>
document.write('&lt;iframe id=&quot;datamain&quot; src=&quot;'+iframesrc+'&quot;
width=&quot;150px&quot; height=&quot;150px&quot; marginwidth=&quot;0&quot;
marginheight=&quot;0&quot; hspace=&quot;0&quot; vspace=&quot;0&quot; frameborder=&quot;1&quot;
scrolling=&quot;no&quot;&gt;&lt;/iframe&gt;')</p>

<p>&lt;/script&gt;</p>
</td>
</tr>
</table>


As you can see, you've accidentally pasted the code as text into your HTML composing program, and it has treated it as such. It's a simple mistake to make. You need to make your HTML code this:



<table width="75%" border="1">
<tr>
<td>
<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>')
</td>
</tr>
</table>
</script>


Regards
cr3ative