View Full Version : Changing HTML
PeterJS
01-28-2003, 10:27 AM
Hi,
Is it possible to make a script to change HTML on the page?
Also, is there a script to remove images from a page?
Reason I ask is that we don't have access to change the HTML, but I would like to alter the table at the top, but don't know how too. Is this possibe?
thanks
Peter :)
Danne
01-28-2003, 12:30 PM
Can you be a little more specific?
PeterJS
01-28-2003, 01:04 PM
I need something to change tables, maybe something to change the width of one of them? I don't have access to the HTML, but can add HTML, Javascript to the page.
As for the script to remove images on a page, I figured that out :D
Thanks
Peter :)
Danne
01-28-2003, 01:25 PM
Something like this?
<html>
<head>
<title> Título </title>
</head>
<script language="JavaScript">
function changeWidth(table,width)
{
table.style.width=width;
}
</script>
<body>
<table id="tbl" border=1 style="width:300px;" cellspacing=0 cellpadding=0>
<tr>
<td>td</td>
<td>td</td>
<td>td</td>
</tr>
<tr>
<td>td</td>
<td>td</td>
<td>td</td>
</tr>
</table>
<input type="button" value="Change to 300px" onClick="changeWidth(tbl,300);">
<input type="button" value="Change to 500px" onClick="changeWidth(tbl,500);">
</body>
</html>
Didn't try it in NS...:rolleyes:
PeterJS
01-28-2003, 02:07 PM
Sorry, better try and explain better.......
I have a remotely hosted message board, and its has a table at the top. I can't add, change or do anything to the table except for change colours from the preferences in my admin section.
There is a section to modify headers and footers. This is where I can add additional things to the board, etc style, html, javascript, images....
I wanted to alter the top table, but can't the way you posted. There are basically 2 tables, 1 at the top and then 1 below that which contains the listed forums. I can't adjust the size of the top one, only the second one by adding <table width="xx%"><tr><td> into the header and adding the closing tags in the footer. Only way I can see of changing the top one is with Javascript.
Peter :)
arnyinc
01-28-2003, 02:31 PM
Does the table (the one you want to change) have the width defined at all? If it is not defined you can put it in another table or a div and shrink it that way. If it is defined as a percentage you can put it in another table or a div and stretch/shrink it that way. Not sure about any way of doing it via javascript.
Danne
01-28-2003, 03:05 PM
Hmm, ok I think I understood this time..:confused:
Maybe you can get the first table through a function like this?
function getTable()
{
var i;
for(i=0;i<document.childNodes.length;i++)
if(document.childNodes[i].tagName=="TABLE")
return document.childNodes[i];
return -1;
}
After that you should be able to make the desired changes...
var headerTbl=getTable();
if(headerTbl!=-1)
{
headerTbl.style.whatever="whatever";
}
Hope I got it this time...:p
whammy
01-29-2003, 12:02 AM
It's likely if you have a remotely hosted message board, that they use the table in question for advertising purposes or whatever - and in that case it's probably against their TOS to modify/change it - have you contacted them?
If it IS against their TOS, then they'll likely refuse to host a message board for your website if you attempt to modify it...
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.