...

View Full Version : Making a solid border when the months change.



dep
01-18-2006, 09:29 PM
hello. i have a table like this, created dynamically

| a | jan | 129 |
| s | jan | 302 |
| r | jan | 293 |

| w | feb | w92 |
.
.
.
.
.
| e | mar | 283 |

What i need to do, with javascript and DOM is when the month changes (at an unset interval) to make a solid line.

Now I know how to make the line. What I don't know is the best way to check if the month is a new month or not.

Any ideas?

dep

dep
01-18-2006, 09:32 PM
Didn't mean to post this twice...

vwphillips
01-18-2006, 09:44 PM
you are creating this dynamically so when the month is not= the previous month draw a line

dep
01-18-2006, 10:03 PM
i guess i'm looking for a more specific answer.

vwphillips
01-18-2006, 10:21 PM
quess you need to post a more specific question.

at the moment can only guess what methods you use.

dep
01-18-2006, 10:29 PM
Ah, well, I'm using Trimpath and Javascript.



{for q in data.optionQuote}
<tr>
<td class="mondo">${q.monthVal|default:"--"}</td>
<td class="mondo">${q.type|default:"--"}</td>
<td class="mondo">${q.desc|default:"--"}</td>
<td class="mondo">${q.etc|default:"--"}</td>
</tr>
{/for}

vwphillips
01-18-2006, 11:14 PM
suggest that you read the posting guidelines



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>
<title></title>
<script language="JavaScript" type="text/javascript">
<!--
function Lines(){
bdy=document.getElementsByTagName('BODY')[0];
tbdy=document.getElementById('fred');
trs=tbdy.getElementsByTagName('TR');
var line=document.createElement('DIV');
var lineS=line.style;
lineS.position='absolute';
lineS.overflow='hidden';
lineS.width=(trs[0].offsetWidth)+'px';
lineS.height=(2)+'px';
lineS.left=zxcPos(trs[0])[0]+'px';
bdy.appendChild(line);
lineS.backgroundColor='black';
for (var zxc0=1;zxc0<trs.length;zxc0++){
if (trs[zxc0].getElementsByTagName('TD')[1].firstChild.data!=trs[zxc0-1].getElementsByTagName('TD')[1].firstChild.data){
nline=line.cloneNode(true);
bdy.appendChild(nline);
nline.style.top=zxcPos(trs[zxc0])[1]+'px';
}
}
bdy.removeChild(line);
}

function zxcPos(zxc){
zxcObjLeft = zxc.offsetLeft;
zxcObjTop = zxc.offsetTop;
while(zxc.offsetParent!=null){
zxcObjParent=zxc.offsetParent;
zxcObjLeft+=zxcObjParent.offsetLeft;
zxcObjTop+=zxcObjParent.offsetTop;
zxc=zxcObjParent;
}
return [zxcObjLeft,zxcObjTop];
}

//-->
</script>
</head>

<body onload="Lines()" >
<table >
<tbody id="fred" >
<tr>
<td class="mondo">${q.monthVal|default:"--"}</td>
<td class="mondo">may</td>
</tr>
<tr>
<td class="mondo">${q.monthVal|default:"--"}</td>
<td class="mondo">may</td>
</tr>
<tr>
<td class="mondo">${q.monthVal|default:"--"}</td>
<td class="mondo">June</td>
</tr>
<tr>
<td class="mondo">${q.monthVal|default:"--"}</td>
<td class="mondo">June</td>
</tr>
<tr>
<td class="mondo">${q.monthVal|default:"--"}</td>
<td class="mondo">July</td>
</tr>

</tbody>
</table>
</body>

</html>



and remember that please and thank you are good when asking other to spend their time on your problem howerer trivial that may be

dep
01-18-2006, 11:51 PM
suggest that you read the posting guidelines



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>
<title></title>
<script language="JavaScript" type="text/javascript">
<!--
function Lines(){
bdy=document.getElementsByTagName('BODY')[0];
tbdy=document.getElementById('fred');
trs=tbdy.getElementsByTagName('TR');
var line=document.createElement('DIV');
var lineS=line.style;
lineS.position='absolute';
lineS.overflow='hidden';
lineS.width=(trs[0].offsetWidth)+'px';
lineS.height=(2)+'px';
lineS.left=zxcPos(trs[0])[0]+'px';
bdy.appendChild(line);
lineS.backgroundColor='black';
for (var zxc0=1;zxc0<trs.length;zxc0++){
if (trs[zxc0].getElementsByTagName('TD')[1].firstChild.data!=trs[zxc0-1].getElementsByTagName('TD')[1].firstChild.data){
nline=line.cloneNode(true);
bdy.appendChild(nline);
nline.style.top=zxcPos(trs[zxc0])[1]+'px';
}
}
bdy.removeChild(line);
}

function zxcPos(zxc){
zxcObjLeft = zxc.offsetLeft;
zxcObjTop = zxc.offsetTop;
while(zxc.offsetParent!=null){
zxcObjParent=zxc.offsetParent;
zxcObjLeft+=zxcObjParent.offsetLeft;
zxcObjTop+=zxcObjParent.offsetTop;
zxc=zxcObjParent;
}
return [zxcObjLeft,zxcObjTop];
}

//-->
</script>
</head>

<body onload="Lines()" >
<table >
<tbody id="fred" >
<tr>
<td class="mondo">${q.monthVal|default:"--"}</td>
<td class="mondo">may</td>
</tr>
<tr>
<td class="mondo">${q.monthVal|default:"--"}</td>
<td class="mondo">may</td>
</tr>
<tr>
<td class="mondo">${q.monthVal|default:"--"}</td>
<td class="mondo">June</td>
</tr>
<tr>
<td class="mondo">${q.monthVal|default:"--"}</td>
<td class="mondo">June</td>
</tr>
<tr>
<td class="mondo">${q.monthVal|default:"--"}</td>
<td class="mondo">July</td>
</tr>

</tbody>
</table>
</body>

</html>



and remember that please and thank you are good when asking other to spend their time on your problem howerer trivial that may be


Thank you.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum