Jump to content


Photo

Expanding table width


  • Please log in to reply
10 replies to this topic

#1 Jocka

Jocka
  • Members
  • PipPipPip
  • Advanced Member
  • 344 posts
  • LocationDallas, Texas

Posted 18 August 2006 - 12:20 AM

all I want this to do is "slowly" expand this tables width. I've tried just about everything i could think/find. I searched many tutorials on google but none of them actually "expand' the table, they just hide it.
I tried using this code, and to ME it looks like it should work.. but it doesn't..

(ITS NOT LETTING ME POST MY JAVASCRIPT CODE SO IM THROWING SOME B/S STUFF IN THERE TO 'HIDE' IT)
<html>
<head>
<--script type="text/-javascript">
function expand(tblid) {
if (tbl = document.getElementById(tblid)) {
var i=0
for (i=0;i<=10;i++)
{
tbl.width=i
}
}
}
</--script>
</head>
<body onload="expand('test')">
<table border="1">
<tr>
<td id="test" name="test">TEST</td>
</tr>
</table>

</body>
</html>
What am I doing wrong here?

#2 radalin

radalin
  • Members
  • PipPipPip
  • Advanced Member
  • 179 posts

Posted 18 August 2006 - 07:47 AM

Well probably the thing is that computer is finishing that loop so quick that you do not see if it expands or not. You should add some delay options there and your code should work then.
Roy Simkes
Yet Another Parkyeri Developer

#3 Jocka

Jocka
  • Members
  • PipPipPip
  • Advanced Member
  • 344 posts
  • LocationDallas, Texas

Posted 18 August 2006 - 02:36 PM

delays might work.. but it's not expanding at all.. the width just stays large enough for the text, never gets bigger.

#4 radalin

radalin
  • Members
  • PipPipPip
  • Advanced Member
  • 179 posts

Posted 19 August 2006 - 01:23 PM

Yeah that was quite intresting. I tried what I said to you. And the thing is delay do not work. Perhaps that I missed something but browser does not redraw the table till the end function (at the end it's expanded by the way but I do not see that expand effect). And delays was nearly crushing my browser :)
Roy Simkes
Yet Another Parkyeri Developer

#5 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 19 August 2006 - 03:27 PM

(ITS NOT LETTING ME POST MY JAVASCRIPT CODE SO IM THROWING SOME B/S STUFF IN THERE TO 'HIDE' IT)


It's because of their Intrusion Prevention System (IPS). More info here: http://www.phpfreaks...c,104265.0.html

#6 Jocka

Jocka
  • Members
  • PipPipPip
  • Advanced Member
  • 344 posts
  • LocationDallas, Texas

Posted 19 August 2006 - 04:19 PM

Yea, I don't get why it's not expanding. It either just sets there or shoots to the max width... i'm lost on this lol. all i wanted to do is make like a little "load" looking thing.

#7 Jocka

Jocka
  • Members
  • PipPipPip
  • Advanced Member
  • 344 posts
  • LocationDallas, Texas

Posted 22 August 2006 - 03:41 AM

*bump*

#8 syed

syed
  • Members
  • PipPipPip
  • Advanced Member
  • 151 posts
  • LocationEngland

Posted 23 August 2006 - 05:48 AM

Hi guys I had a go at it. I have it working, needs a bit of work. I have tried many times to post the code, but i get a page not found or something and when i did post it, the javascript was missing,  if u want it mail me and i will mail you the code, or just come visit me at my site and i will post it for u. Sorry guys, i did try my best to post it here. my site is www.cy2online.net

#9 Jocka

Jocka
  • Members
  • PipPipPip
  • Advanced Member
  • 344 posts
  • LocationDallas, Texas

Posted 24 August 2006 - 04:30 PM

Hi guys I had a go at it. I have it working, needs a bit of work. I have tried many times to post the code, but i get a page not found or something and when i did post it, the javascript was missing,  if u want it mail me and i will mail you the code, or just come visit me at my site and i will post it for u. Sorry guys, i did try my best to post it here. my site is www.cy2online.net

You can post it here, but you have to edit the javascript like I did. put dashes in it like this:
<--script type="text/-javascript">

// code

</---script>


#10 syed

syed
  • Members
  • PipPipPip
  • Advanced Member
  • 151 posts
  • LocationEngland

Posted 26 August 2006 - 12:56 AM

This is the code.

<style>

td.td1
{
font-family:tahoma;
}

</style>

<script language=javascript>

var counter=0;

function expand(){

counter = counter +10;

if (counter <= 100){
Id = window.setTimeout("expand()",15);
}


document.getElementById("td1").innerHTML = "<table border=1><tr><td valign=top height='" + counter + "'>Test</td></tr></table>";
}

</script>

<a href="#" onclick="expand()">Expand</a>

<table>
<tr>
<td id="td1" class="td1"></td>
</tr>
</table>

#11 syed

syed
  • Members
  • PipPipPip
  • Advanced Member
  • 151 posts
  • LocationEngland

Posted 26 August 2006 - 12:58 AM

This forum is so messed up. You need to replace where it says Expand [/url] it should be Expand </ a>.  remove the space. Let me know if you get it to work.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users