I am trying to set up a script that will use javascript to set the width of a table to a random number generated, and i haven't the first clue about javascript so i'm lost. Does anyone know how i could accomplish this, or if it's even possible?
Printable View
I am trying to set up a script that will use javascript to set the width of a table to a random number generated, and i haven't the first clue about javascript so i'm lost. Does anyone know how i could accomplish this, or if it's even possible?
OK, this is totally untested codeL
Code:<html>
<body>
<script type="text/javascript">
min = 200
max = 500
rnd = (math.round()*(max-min))+max
document.write("<table width='"+rnd+"'>")
document.write("<td>")
document.write("<tr>")
document.write("weeee")
document.write("</td>")
document.write("</tr>")
document.write("</table>")
</script>
</body>
</html>
What i had used originally was pretty similar to that, but i had some slight errors in it that were not allowing it to work...seeing how you did yours, showed me the error i had in mine, which allowed me to correct my problem and it works now. Thank you.