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
Originally posted by Jona document.form is not acceptible. Change the name of your form to something else. Or use document.forms[0] if you only have one form on the page.
document.form works fine with the existing navbar generator. I was asking how to write a function addlink() to improve the generator.
<html><head>
<script>
function process() {
var rows = parseInt(document.form.rows.value)
var cols = parseInt(document.form.cols.value)
var width = parseInt(document.form.width.value)
var border = parseInt(document.form.border.value)
var bordercolor = document.form.bordercolor.value
var cellpadding = parseInt(document.form.cellpadding.value)
var align = document.form.align.value
var tdalign = document.form.tdalign.value
var MouseOver = document.form.MouseOver.value
var MouseOut = document.form.MouseOut.value
var url = document.form.url.value
var textcolor = document.form.textcolor.value
var bgcolor = document.form.bgcolor.value
[QUOTE]Originally posted by Jona
[B]Here you go. I got it all figured out.
Jona,
Thanks for trying. Your script is simpler and more elegant than mine, but it produces exactly the same result:
Link 1
Link 2
Link 3 (all with the same URL)
I want the form user to input separate link names and link URLs for each table cell. As I see it, I have to write some sort of function addlink () to replace these lines of the script:
table +=<a href='"+url+"'>\n"
table += "Link"+i+"\n"
But I don't know how to do it.
You do not necessarily have to create another function to do this. The thing is, you're going to have to have a lot of text fields for them to put the URLs and names of the links in... You can try using the eval() method.
Visit Slightly Remarkable to see my portfolio, resumé, and consulting rates.
Bookmarks