UBB.Dev
Posted By: Raziel Image Repeat - 04/30/2006 2:17 PM
does anyone know how i can edit this code so that , if the page is stretched, the image appended would repeate ?


function headBase(theTable){
var pTD = theTable.parentNode;
if(pTD.firstChild.nodeName == "DIV"){
return false;
}
var hDiv = document.createElement("div");
hDiv.align = "center";
var hImg = new Image();
hImg.src = headImg;
hDiv.appendChild(hImg);
var bDiv = hDiv.cloneNode(true);
bDiv.firstChild.src = baseImg;
pTD.insertBefore(hDiv, theTable);
if(theTable.nextSibling){
pTD.insertBefore(bDiv, theTable.nextSibling);
}else{
pTD.appendChild(bDiv);
}
}
Posted By: AllenAyres Re: Image Repeat - 05/01/2006 2:39 AM
what language is that? perl? php?
Posted By: Gizmo Re: Image Repeat - 05/01/2006 8:30 AM
Javascript I'm assuming...
Posted By: Burak Re: Image Repeat - 05/01/2006 4:46 PM
all css properties can be modified via js, but notation is different (background-repeat is backgroundRepeat etc.)

Code
// foo is <td id="foo">
var o = document.getElementById('foo');
var s = o.style;
s.background = "url('a.gif')";
s.backgroundRepeat = "repeat";
in your code, I think that "o" is "bDiv.firstChild" ...

You can probe any object to see it's properties:

Code
if (typeof s == 'object') {
for(key in s) document.writeln(key+':'+s[key]);
}
Posted By: Raziel Re: Image Repeat - 05/01/2006 5:42 PM
well this is Javascript , may apologizes for not stating that

this is a compleate version of the code.


Code
  
var baseImg = "BASE IMAGE URL";
var headImg = "HEAD IMAGE URL";

function headBase(theTable){
var pTD = theTable.parentNode;
if(pTD.firstChild.nodeName == "DIV"){
return false;
}
var hDiv = document.createElement("div");
hDiv.align = "center";
var hImg = new Image();
hImg.src = headImg;
hDiv.appendChild(hImg);
var bDiv = hDiv.cloneNode(true);
bDiv.firstChild.src = baseImg;
pTD.insertBefore(hDiv, theTable);
if(theTable.nextSibling){
pTD.insertBefore(bDiv, theTable.nextSibling);
}else{
pTD.appendChild(bDiv);
}
}

var iTable = document.getElementsByTagName("table");
if(location.href.match(/com|index.cgi/)){
for(t=4; t<iTable.length; t++){
if(iTable[t].width == "100%" && iTable[t].className == "bordercolor"){
headBase(iTable[t]);
}
}
}
you see it add an image above a table, for forums, like over here thier is an image between each catagory, only in this case its one image. I want the image added above and below(head/base)to repeate, its not exaclty a background.

[add the script tags acordingly , i cant add them it doesnt let me tipsy ]


thanks for your responses. smile
© UBB.Developers