Forum Moderators: open

Message Too Old, No Replies

how do i get this javascript on a mac?

         

soadfan

5:22 am on Feb 21, 2005 (gmt 0)

10+ Year Member



i have this code that dynamically creates rows and columns in a table and populates it. it works in IE, firefox, netscape but i cant get it to work on a mac, so i need help:
you can see it tested here:
[68.53.5.167...]

if you try it on IE on a mac, it does nothing.
here is the exact code or you can view source on that page:

<script>
function setUp()
{

ns4=(document.layers)?1:0;
ie4=(document.all)?1:0;
sdom=(document.getElementById && (!(ie4¦¦ns4)))?1:0;
//alert(""+ns4+" "+ie4+" "+sdom);
if(ns4)
{
alert("Upgrade your browser");

}
else if(ie4)
{
sizeTablePath = document.all.sizeTable;

}
else if(sdom)
{
sizeTablePath = document.getElementById('sizeTable');

}

}

function populateSizeTable()
{

size = new Array(3);

size[1-1] = "26";

size[2-1] = "28";

size[3-1] = "30";

clearTable();
table = sizeTablePath;
var length = size.length;
var numCols = 7;
var numRows = Math.ceil(length / numCols);
for( i = 0; i < numRows; i++ )
{
row = table.insertRow(table.rows.length);
var cols = numCols*(i+1);
for( j = numCols*i; j < cols; j++ )
{
sizeNum = (j < length)?(size[j]):0;
cell1inner = (j < length)?"<font face='Arial' size='1'>" + sizeNum +"-</font>":"&nbsp;";
cell2inner = (j < length)?"<input name='size" + sizeNum + "'type='text' size='2' maxsize='2' value='' >":"&nbsp;";
cell1 = row.insertCell(row.cells.length);
cell1.setAttribute('align','center');
cell1.setAttribute('width','30');
cell1.innerHTML = cell1inner;
cell2 = row.insertCell(row.cells.length);
cell2.setAttribute('align','center');
cell2.setAttribute('width','47');
cell2.innerHTML = cell2inner;
}
}
}

function clearTable()
{
table = sizeTablePath;
while( table.rows.length > 0 )
{
table.deleteRow(0);
}
}
</script>

</head>

<body onload="setUp();">
<table id="sizeTable" width="200" border="0">

</table>

<input type="button"
onclick="populateSizeTable()"
value="Call function">
</body>
</html>

any ideas? is innerHtml supported on mac browsers? i read it does, so im not sure what else it could be. thanks

lZakl

1:20 pm on Feb 21, 2005 (gmt 0)

10+ Year Member



I didn't want to tear through the amount of code you have there... But I know I use this bit of code:

<html>
<head>

<SCRIPT LANGUAGE="JavaScript">
<!--
function menu1()
{
document.getElementById("inside").innerHTML = "<tr><td>your inner html</td></tr>";
}

// -->
</SCRIPT>

</head>
<body>
<DIV id="inside">

<table>
Used to be here
</table>

</DIV>

<input type="submit" onclick="menu1()">

</body></html>

I know this works for Mac version of IE. Something to remember when you are trying to please the Mac Gods is that Microsoft no longer has any plans for IE with Mac. It is quickly becoming a taboo to even have IE installed on Mac's nowadays. If you can't get it to work for IE Mac, but it works for everything else that you know of, I'd just leave it (if it were me). About 3% of surfers right now are using IE 5.x for Mac, so if your happy with 97% of your users being able to see your site... If you have a limited # of mac users that use your site, I'd tell them to get Firefox, or use Safari (inferior to Firefox albeit) which comes pre-installed on all Macintosh computers (OS X that is, if they are using OS 9, that's yet another quickly forming taboo).

-- Zak

soadfan

5:23 pm on Feb 21, 2005 (gmt 0)

10+ Year Member



thanks im gonna try that out today and ill let u know what happens. of course i would love to leave it, but my work as always only sees the negative:
me: hey looks this works on every browser!
my boss: even macs?
me: well, no..
my boss: not good enough go fix it for the .0001% of our customers who use macs!
:(