Table column widths are different on the web than what is specified in sourc code.

Please take a look at this link: http://designamania.com/DesertSands/DesertSands.htm
As you can see from the source code, all three columns are coded to be 250 px wide. And yet when I insert an SWF file in the middle square, it distorts the width of the column.
What's causing that, and how do I fix it?

Thanks!
John
LVL 1
John CarneyReliability Business Tools Analyst IIAsked:
Who is Participating?
 
dodge20Commented:
It would be something like this (your swf and js file are located in the same directory as your html page.

Your foo.js page would look like this
function RunFoo()
{
   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="720" height="540">\n');
   document.write('<param name="movie" value="Brick%20Wall.swf" />\n');
   document.write('<param name="quality" value="high" />\n');
   document.write('<embed src="Brick%20Wall.swf" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="720" height="540"></embed>\n');
   document.write('</object>\n');
}

Also a tip - don't use spaces when naming files. You is it puts in a %20 for the space. Not all browsers will read this. I would name it BrickWall.swf and adjust the file name accordingly.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>JC Portfolio</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<script src="foo.js" type="text/javascript"></script>
<style type="text/css">
<!--
body {
	background-color: #000000;
	background-repeat: repeat-x;
}
-->
</style>
</head>	
 
<div align="center">
  <p>&nbsp;</p>
  <p>
<script type="text/javascript">RunFoo();</script>
    </object>
  </p>
</div>
</body>
</html>

Open in new window

0
 
dodge20Commented:
The reason it is doing this, is because you don't have your cellspacing set to 0 so the cell space is taking up 1px so you are calling for more space than you have.

You have 3 options
either change
<table width="750" height="388" border="0" cellpadding="0">
to
<table width="750" height="388" border="0" cellpadding="0" cellspacing="0">

Or
Remove the width="250" from the middle cell of your table (the one that contains the flash) With your other 2 being set to 250, the middle cell will take up the remaining space.

Or Make your table width larger. (Worst option).
0
 
John CarneyReliability Business Tools Analyst IIAuthor Commented:
Hi dosge20,

Thanks! I thought that would do it but i tried all three and none of them worked. Obviously I'm doing something wrong. Could you replace rewrite all the table code attached below so that it will work?

Thanks,

John
    <tr>
      <th width="250" height="168" scope="col">Something here </th>
      <th width="250" scope="col"><div align="center">
        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="211" height="144">
            <param name="movie" value="Desert Tween.swf">
            <param name=quality value=high>
            <embed src="Desert Tween.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="211" height="144"></embed>
        </object>
      </div></th>
      <th width="250" scope="col">Something here </th>
    </tr>

Open in new window

0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
dodge20Commented:


Option 1
--------------------------------------
<table width="750" height="388" border="0" cellpadding="0" cellspacing="0">
    <tr bgcolor="#FF9900">
 
      <th height="48" colspan="3" scope="col"><div align="right"><span class="style6">desert sands</span></div></th>
    </tr>
    <tr>
      <th width="250" height="168" scope="col">Something here </th>
      <th width="250" scope="col"><div align="center">
        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="211" height="144">
            <param name="movie" value="Desert Tween.swf">
            <param name=quality value=high>
 
            <embed src="Desert Tween.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="211" height="144"></embed>
        </object>
      </div></th>
      <th width="250" scope="col">Something here </th>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td colspan="3"><div align="justify">
        <blockquote>
 
          <p><span class="style2">All across the world, winds blow and the sun beats down and rain doesn't rain and what little moisture there is disappears. .Deserts grow. Trees vanish. Streams dry up. All across the world, winds blow and the sun beats down and rain doesn't rain and what little moisture there is disappears. .Deserts grow. Trees vanish. Streams dry up.All across the world, winds blow and the sun beats down and rain doesn't rain and what little moisture there is disappears. .Deserts grow. Trees vanish. Streams dry up.All across the world, winds blow and the sun beats down and rain doesn't rain and what little moisture there is disappears. .Deserts grow. Trees vanish. Streams dry up.</span></p>
        </blockquote>
      </div></td>
    </tr>
  </table>
 
 
Option2
--------------------------
<tr>
      <th width="250" height="168" scope="col">Something here </th>
      <th scope="col"><div align="center">
        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="211" height="144">
            <param name="movie" value="Desert Tween.swf">
            <param name=quality value=high>
 
            <embed src="Desert Tween.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="211" height="144"></embed>
        </object>
      </div></th>
      <th width="250" scope="col">Something here </th>
    </tr>

Open in new window

0
 
dodge20Commented:
Actually after looking closer, I don't think your table code is correct. You have your colspan in the th and not the td Try this.
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr bgcolor="#FF9900">
    <td colspan="3"><div align="right"><span class="style6">desert sands</span></div></td>
  </tr>
  <tr>
    <td width="250" height="168"><div align="center">Something here</div></td>
    <td width="250"><div align="center"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="211" height="144">
              <param name="movie" value="Desert Tween.swf">
              <param name=quality value=high>
        
            <embed src="Desert Tween.swf" width="211" height="144" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash"></embed>
    </object></div></td>
    <td width="250"><div align="center">Something here</div></td>
  </tr>
  <tr>
    <td colspan="3"><span class="style2">All across the world, winds blow and the sun beats down and rain doesn't rain and what little moisture there is disappears. .Deserts grow. Trees vanish. Streams dry up. All across the world, winds blow and the sun beats down and rain doesn't rain and what little moisture there is disappears. .Deserts grow. Trees vanish. Streams dry up.All across the world, winds blow and the sun beats down and rain doesn't rain and what little moisture there is disappears. .Deserts grow. Trees vanish. Streams dry up.All across the world, winds blow and the sun beats down and rain doesn't rain and what little moisture there is disappears. .Deserts grow. Trees vanish. Streams dry up.</span></td>
  </tr>
</table>

Open in new window

0
 
John CarneyReliability Business Tools Analyst IIAuthor Commented:
I still can't get it to work. in preview Could you please take a look at my source code again and then - because I am so dense  - could you correct the entire code for me?

Thanks,

John
0
 
dodge20Commented:
No problem - you aren't dense, i did make a mistake on my initial response.

See if this page code works for you.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
.style2 {
	font-family: "Gill Sans MT";
	margin-right: 0px;
	margin-left: 0px;
}
.style6 {
	font-family: "Monotype Corsiva";
	color: #FFFFFF;
	font-size: 36px;
	padding-right: 40px;
}
-->
</style>
</head>
 
<body>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr bgcolor="#FF9900">
    <td colspan="3"><div align="right"><span class="style6">desert sands</span></div></td>
  </tr>
  <tr>
    <td width="250" height="168"><div align="center">Something here</div></td>
    <td width="250"><div align="center"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="211" height="144">
              <param name="movie" value="Desert Tween.swf">
              <param name=quality value=high>
        
            <embed src="Desert Tween.swf" width="211" height="144" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash"></embed>
    </object></div></td>
    <td width="250"><div align="center">Something here</div></td>
  </tr>
  <tr>
  
    <td colspan="3"><blockquote><div align="justify"><span class="style2">All across the world, winds blow and the sun beats down and rain doesn't rain and what little moisture there is disappears. .Deserts grow. Trees vanish. Streams dry up. All across the world, winds blow and the sun beats down and rain doesn't rain and what little moisture there is disappears. .Deserts grow. Trees vanish. Streams dry up.All across the world, winds blow and the sun beats down and rain doesn't rain and what little moisture there is disappears. .Deserts grow. Trees vanish. Streams dry up.All across the world, winds blow and the sun beats down and rain doesn't rain and what little moisture there is disappears. .Deserts grow. Trees vanish. Streams dry up.</span></div></blockquote></td>
  </tr>
</table>
</body>
</html>

Open in new window

0
 
John CarneyReliability Business Tools Analyst IIAuthor Commented:
You won't believe it but it turns out that the problem is the merged cell in the third row! This is not a problem with a single line of text, but it becomes a problem as soon as the text wraps to a second line! Have you ever encountered this before? For that matter do you encounter it when you publish an html doc with my code? Is it a bug in Dreamweaver MX2004?
The workaround of course is to create a second single column table underneath the first table, but is there a way to fix the "merged-cell-wrap-text" problem directly.

Thanks,
John
0
 
dodge20Commented:
I was testing it in firefox and everything seemed fine. I just tested it in Internet explorer and saw the problem you were talking about. My guess is that it is because MX 2004 doesn't embed the flash correctly and IE does something to throw off the look of the site. Take a look at this article - it shows how to correctly embed flash for IE

http://www.adobe.com/devnet/activecontent/articles/devletter.html

Once it is correctly embedded, let us know what the result is.
0
 
John CarneyReliability Business Tools Analyst IIAuthor Commented:
I love the proposed solution, and I will definitely accept it,  but it seems to address another important issue even more.  I tried applying the "External JavaScript solution 1: For single (or few) occurrences of embedded content" to another simpler document containing no tables, just one SWF, and I couldn't get it to work.
There are too many things I don't understand, so could you please rewrite the code below with the changes recommended in JavaScript solution1, so that it will produce the desired results?
Also please tell me exactly what external files need to be where, and what they should be called for everything to work.


If you could do that, I think I'd be able to start understanding how it works.

Thanks!

John
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>JC Portfolio</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<style type="text/css">
<!--
body {
	background-color: #000000;
	background-repeat: repeat-x;
}
-->
</style>
</head>	
 
<div align="center">
  <p>&nbsp;</p>
  <p>
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="720" height="540">
      <param name="movie" value="../Brick%20Wall.swf">
      <param name=quality value=high>
      <embed src="../Brick%20Wall.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="720" height="540"></embed>
    </object>
  </p>
</div>
</body>
</html>

Open in new window

0
 
John CarneyReliability Business Tools Analyst IIAuthor Commented:
It's starting to make sense to me, but I must still be missing something, because when I preview in my browser I get a blank page.  Here's what I've got:

1) I created a javascript file, and copied and pasted your script into it.
2) I replaced my html code with your code.
3) I changed "Brick Wall.swf" to "BrickWall.swf"
All three are in the same folder.  What am I doing wrong?

I'm just going to award the points and close the question, but could you keep checking back in until i can solve this problem which has been vexing mw for months.

Thanks,

John
0
 
dodge20Commented:
if you changed the name of your file - did you change all of the Brick%20Wall.swf to BrickWall.swf?

Did you name your js file foo.js?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.