Jump to content

Archived

This topic is now archived and is closed to further replies.

Jocka

Expanding table width

Recommended Posts

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)
[code]
<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>
[/code]
What am I doing wrong here?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
delays might work.. but it's not expanding at all.. the width just stays large enough for the text, never gets bigger.

Share this post


Link to post
Share on other sites
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 :)

Share this post


Link to post
Share on other sites
[quote author=Jocka link=topic=104692.msg417743#msg417743 date=1155860426]
(ITS NOT LETTING ME POST MY JAVASCRIPT CODE SO IM THROWING SOME B/S STUFF IN THERE TO 'HIDE' IT)
[/quote]

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
[quote author=syed link=topic=104692.msg420474#msg420474 date=1156312097]
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
[/quote]
You can post it here, but you have to edit the javascript like I did. put dashes in it like this:
[code]
<--script type="text/-javascript">

// code

</---script>
[/code]

Share this post


Link to post
Share on other sites
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>

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.