Forum Moderators: mack

Message Too Old, No Replies

My script added space in my table

Extra space after script added to table

         

stealth311

7:43 pm on Jun 8, 2003 (gmt 0)

10+ Year Member



I had a 3x3 table. The top and bottom rows' colspan 3, and the images do not change. The left and right cells of the middle row also do not change. I want it set up so that when somebody clicks on the middle image, it opens new page, tattooguy.gif. I had the table set up, and everything aligned perfectly. Once I added the script to the middle image, it added a 1 pixel high row above and below the row. I used "<TR valign="top" HEIGHT=268>" so that everything would align to the top at a fixed height, and now I have a 2 pix row between the 2nd, and 3rd rows. I tried removing the script from the middle cell, and everything aligned correctly again, but it would not open a new window. I am adding the table below to possibly help clarify. How do I get rid of that 2 pixel high row. Please advise.

<TABLE WIDTH="575" height="400" BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR valign="top" HEIGHT=30>
<TD COLSPAN="3" ><IMG SRC="websites/webbig_top.gif" WIDTH=575 HEIGHT=30 ALT="" BORDER="0"></TD>
</TR>
<TR valign="top" HEIGHT=268>
<TD><IMG SRC="websites/webbig_left.gif" WIDTH=57 HEIGHT=268 ALT="" BORDER="0"></TD>
<TD>
<SCRIPT LANGUAGE="JavaScript" type='text/javascript' >
<!-- // hide script from old browsers
function launch() {
open('http://www.*****.com/photocontest/tattooguy.gif','GIF','resizable=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,width=383,height=575')
}
document.write('<A HREF="javascript:launch()" border="0" height=268><IMG SRC="emails/letterhead_big.gif" WIDTH=463 HEIGHT=268 ALT="" BORDER="0"></A>')
// end hiding contents
-->
</SCRIPT>
</TD>
<TD><IMG SRC="websites/webbig_right.gif" WIDTH=55 HEIGHT=268 ALT="" BORDER="0"></TD>
</TR>
<TR valign="top" HEIGHT=102>
<TD COLSPAN="3"><IMG SRC="emails/emailbig_bottom.gif" WIDTH=575 HEIGHT=102 ALT="" BORDER="0"></TD>
</TR>
</TABLE>

[edited by: JamesR at 5:13 pm (utc) on June 9, 2003]
[edit reason] No specific URLs in code please [/edit]

Sinner_G

7:59 pm on Jun 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Does the same thing happen if you have a regular image link instead of a JS function?

If yes, it might be because the element 'border' is now deprecated.

Try a CSS 'img { border:none }' instead.

stealth311

8:04 pm on Jun 8, 2003 (gmt 0)

10+ Year Member


No. I originally had an image in there which was hyperlinked to a new page. I wanted to avoid that, and open a fresh new window for them to see the .gif/.jpg. I got the java to work correctly, but it added the line. I added "border="0"" to all images, and tags.

stealth311

8:06 pm on Jun 8, 2003 (gmt 0)

10+ Year Member


CSS? I'm new to Java. What does that mean, and specifically where shoud I put it?

Sinner_G

8:31 pm on Jun 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ok, first welcome to WebmasterWorld (hadn't noticed before) :).

Then, what you have is JavaScript, not Java, which are two completely different things, only things they have in common are the name similarity and that they are often used on the web.

CSS are Cascading Style Sheets. There is even a special forum [webmasterworld.com] for them here. In short, they are used (among other things) to specify once in your document how things should look like. In this particular case, try putting the following code in the HEAD of your page:

<style type="text/css">
img { border:none }
</style>

This will specify no border for all the images in your document.

stealth311

8:44 pm on Jun 8, 2003 (gmt 0)

10+ Year Member


Thanks, I just found your site today. I am mostly self taught, and if I haven't tripped over it yet, I don't have a clue what I'm talking about.

I did what you suggested and it didn't help. I really don't think it is a border issue. I originally had the same image in the same cell, only not JavaScripted to open a new page, it was linked to the new page. When it was set up like that, the table fit perfectly. The only change was the JavaScript. I tried deleting the cell with the JavaScript, and everything fit again. It has to be the JavaScript.

Sinner_G

8:57 pm on Jun 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ok, I think I've got it. Try putting the </script> and the </td> on the same line:

...
-->
</script></td>

stealth311

9:15 pm on Jun 8, 2003 (gmt 0)

10+ Year Member


That is absolutely amazing. I have been pulling my hair out for 4 hours today. You were a great help. I shall come here whenever I have a question again. Great job!

Sinner_G

9:27 pm on Jun 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



My pleasure :). In fact, I don't really know why that problem surfaced. In fact I only found out because I did a test page. When I opened it with Opera (which is my default browser), I couldn't see the problem. Then I opened it with IE and saw it.

After a while of coding HTML you start noticing that often when IE has a problem which other browsers don't have it's due to white spaces somewhere in your code.