I'm a novice and I've been working on this for weeks. It's a generator for navbars with table cell bgcolor change onmouseover. So far it only produces the word "Link" in each table cell, requiring the user to insert the actual link name and URL manually. I want the user to be able to enter the linkname and URL on the form and have this data inserted into the proper <td> line of generated code. I know this requires function addlink(), but I can't figure out how to write one that works. Here's my script so far:
// Start Generator Function
function process() {
// Set Variables
var rows = document.form.rows.value * 1
var cols = document.form.cols.value * 1
var width = document.form.width.value * 1
var border = document.form.border.value * 1
var bordercolor = document.form.bordercolor.value
var cellpadding = document.form.cellpadding.value * 1
var align = document.form.align.value
var tdalign = document.form.tdalign.value
var onMouseOver = document.form.onMouseOver.value
var onMouseOut = document.form.onMouseOut.value
var url = document.form.url.value
var textcolor = document.form.textcolor.value
var bgcolor = document.form.bgcolor.value
// Table tag creation
var table = "<table width=\"" + width + "\"\n"
table += " border=\"" + border + "\"\n"
table += " bordercolor=\"" + bordercolor + "\"\n"
table += " cellpadding=\"" + cellpadding + "\"\n"
table += " cellspacing=\"0" + "\"\n"
table += " align=\"" + align + "\"\n"
table += " bgColor=\"" + bgcolor + "\"\n"
// Calculate the width for <TD>
var tdwidth = width / cols
// Start Main Loop
for (i = 1; i <= rows; i++) {
table += "<tr>\n"
// TD Loop
for (t = 1; t <= cols; t++) {
table += "<td width=\"" + tdwidth + "\" align=\"" + tdalign + "\" onMouseOver=\"" + onMouseOver + "\" onMouseOut=\"" + onMouseOut + "\"><a href=http://www.webdeveloper.com/forum/archive/index.php/\"" + url + "\">\n"
table += "<font color=\"" + textcolor + "\">\n"
table += " Link " + i +" \n"
table += "</td>\n"
}
table += "</tr>\n\n"
}
// Start Generator Function
function process() {
// Set Variables
var rows = document.form.rows.value * 1
var cols = document.form.cols.value * 1
var width = document.form.width.value * 1
var border = document.form.border.value * 1
var bordercolor = document.form.bordercolor.value
var cellpadding = document.form.cellpadding.value * 1
var align = document.form.align.value
var tdalign = document.form.tdalign.value
var onMouseOver = document.form.onMouseOver.value
var onMouseOut = document.form.onMouseOut.value
var url = document.form.url.value
var textcolor = document.form.textcolor.value
var bgcolor = document.form.bgcolor.value
// Table tag creation
var table = "<table width=\"" + width + "\"\n"
table += " border=\"" + border + "\"\n"
table += " bordercolor=\"" + bordercolor + "\"\n"
table += " cellpadding=\"" + cellpadding + "\"\n"
table += " cellspacing=\"0" + "\"\n"
table += " align=\"" + align + "\"\n"
table += " bgColor=\"" + bgcolor + "\"\n"
// Calculate the width for <TD>
var tdwidth = width / cols
// Start Main Loop
for (i = 1; i <= rows; i++) {
table += "<tr>\n"
// TD Loop
for (t = 1; t <= cols; t++) {
table += "<td width=\"" + tdwidth + "\" align=\"" + tdalign + "\" onMouseOver=\"" + onMouseOver + "\" onMouseOut=\"" + onMouseOut + "\"><a href=http://www.webdeveloper.com/forum/archive/index.php/\"" + url + "\">\n"
table += "<font color=\"" + textcolor + "\">\n"
table += " Link " + i +" \n"
table += "</td>\n"
}
table += "</tr>\n\n"
}