Computing.Net > Forums > Web Development > Javascript download menu problems

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Javascript download menu problems

Reply to Message Icon

Name: zach williams
Date: February 9, 2005 at 12:18:07 Pacific
OS: xp pro
CPU/Ram: 3.4g 512ddr2
Comment:

Hi,

I am having problems getting two javascript download menu's to work.

If put in another menu neither will work.
I dont know what to do. Do i need two jascripts or what? I want the two download menus since i have two distinct categories.

You can look that the page to see what i am trying to do. Notice that i just took down some stuff off the page and just put up a notice, but the two forms are there. The code isnt correct and all im sure.

Im really lost of ideas and i have searched and searched for how to get two menus. I have also tried naming teh form tag to but nothing works. If someone could tell me how it would be greatly appreaciated.

Thanks




Sponsored Link
Ads by Google

Response Number 1
Name: zach williams
Date: February 9, 2005 at 12:19:52 Pacific
Reply:

Here is the address. http://www.zmwilliams.com/documents.htm


0

Response Number 2
Name: Michael J (by mjdamato)
Date: February 9, 2005 at 14:01:47 Pacific
Reply:

The first thing that i notice is that you have two forms and you gave them both the same name. Can't do that. They need to have unique names.

First, give them unique names such as form1 and form2 (or something that makes sense to you). Then change the Go button onclick events to be this:

onclick="javascript:formHandler(this.form)"

Lastly change the formHandler function to this:

function formHandler(form){
var URL = form.site.options{form.site.selectedIndex].value;
window.location.href = URL;
}

Michael J


0

Response Number 3
Name: Michael J (by mjdamato)
Date: February 9, 2005 at 14:04:23 Pacific
Reply:

Sorry, messed up one of the characters in the function. Should be this:

function formHandler(form){
var URL = form.site.options[form.site.selectedIndex].value;
window.location.href = URL;
}

Michael J


0

Response Number 4
Name: zach williams
Date: February 9, 2005 at 16:18:41 Pacific
Reply:

Ok now on the form thing do i need seperate scripts kinda like this.

First one:
function formHandler(form2){
var URL = form.site.options[form2.site.selectedIndex].value;
window.location.href = URL;
}
onclick="javascript:formHandler(this.form2)"

Second form:
function formHandler(form1){
var URL = form1.site.options[form1.site.selectedIndex].value;
window.location.href = URL;
}
onclick="javascript:formHandler(this.form1)"

Do i even need to put the form name where it says form or what? like i did form1 form2

Because i have tried naming them different forms then testing them out on preview since i already have the files uploaded.

By the way i am using dreamweaver mx if that matters any.

Thanks


0

Response Number 5
Name: Michael J (by mjdamato)
Date: February 9, 2005 at 17:43:45 Pacific
Reply:

Just follow exactly what i wrote and it will work. Give the forms two differnt names (it doesn't matter what).

Then each button needs to use the onClick event: onclick="javascript:formHandler(this.form)"
You do not need to rename anything - they will both be the same. "this.form" is a pointer to the current form - that's why you can name the forms anything you want.

You need just one function as I wrote above:
function formHandler(form){
var URL = form.site.options[form.site.selectedIndex].value;
window.location.href = URL;
}

The onClick event handlers are passing the form as a variable to the function as I described earlier. The first line of the function (function formHandler(form){
) assigns the form that is passed to the function as the variable 'form'.

As for DreamWeaver I cannot give you any advice. I write all of my own code. Never used any WYSIWYG programs. Go ahead and give it a try. If you run into any problems, post back here and click the Alert Me link on one of my posts. Good luck!

Michael J


0

Related Posts

See More



Response Number 6
Name: zach williams
Date: February 9, 2005 at 19:07:10 Pacific
Reply:

Thanks!

It works now!


0

Response Number 7
Name: Michael J (by mjdamato)
Date: February 9, 2005 at 19:26:35 Pacific
Reply:

My pleasure

Michael J


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: Javascript download menu problems

Menu Problem www.computing.net/answers/webdevel/menu-problem/3069.html

Drop down Menu problem www.computing.net/answers/webdevel/drop-down-menu-problem/292.html

javascript menu www.computing.net/answers/webdevel/javascript-menu/1696.html