473,503 Members | 2,720 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Please help with a Javascript!

Hello, I am having problems with one of the java scripts on my website
and I was hoping that maybe someone could tell me what I'm doing wrong
and how to fix my problem.

The problem is that I have a pull down menu in the middle of one of
the pages of my website
http://www.pictronicaenterprises.com/photography.htm
and it does not seem to be working properly on macintosh systems using
Safari or Firefox Browsers. It works fine on Internet Explorer and
Netscape.

If you could please take a look at the page and the source code to see
if you can figure out what the problem is for me, I would really
appreciate your help. Or if you know a script that you know works in
safari as a pull down menu, maybe you could share the code with me.

Thank you in advance for your time and help.
Have a great day!
Christopher Walsh
Pictronica Enterprises
http://www.pictronicaenterprises.com
Jul 23 '05 #1
5 1266
Christopher Walsh wrote:
Hello, I am having problems with one of the java scripts on my website
and I was hoping that maybe someone could tell me what I'm doing wrong
1. Talking of "java scripts". It's JavaScript (one word).

2. Using a vague subject line.

3. Writing somewhat broken HTML code. http://validator.w3.org/ is your
friend.
and how to fix my problem.

<snip>

It appears that Safari doesn't recognise the assign method. I don't see
what the point is - assigning in the normal way works perfectly fine.

Moreover, you can get the value of the selected item directly - no need
to go through the index.

This code works in Safari, IE and Mozilla:

function openDir(form) {
if (document.form.fieldname.selectedIndex != 0)
cururl = document.form.fieldname.value;
window.location.href = cururl;
}
}

(Your alert on selecting "CHOOSE A PHOTO GALLERY" seemed pointless to
me, so I removed it.)

HTH

Stewart.
Jul 23 '05 #2
Stewart Gordon wrote:

<snip>
function openDir(form) {
if (document.form.fieldname.selectedIndex != 0)
cururl = document.form.fieldname.value;
window.location.href = cururl;
}
}


Oops, I don't know where the open brace got lost.

But we might as well cut out another middleman....

function openDir(form) {
if (document.form.fieldname.selectedIndex != 0) {
window.location.href = document.form.fieldname.value;
}
}

Stewart.
Jul 23 '05 #3
On Mon, 25 Oct 2004 17:21:03 +0100, Stewart Gordon <sm*******@yahoo.com>
wrote:
Stewart Gordon wrote:

<snip>
function openDir(form) {
if (document.form.fieldname.selectedIndex != 0)
cururl = document.form.fieldname.value;

[snip]
But we might as well cut out another middleman....
Particularly as it was global. Always use the var keyword to declare
variables.
function openDir(form) {
if (document.form.fieldname.selectedIndex != 0) {
window.location.href = document.form.fieldname.value;
}
}


Perhaps you meant:

form.fieldname

so that the function argument is actually used. However, based on what the
OP is trying do, this:

<select onchange="openDir(this);">
function openDir(elem) {
var i = elem.selectedIndex;
if(0 != i) {location = elem.options[i].value;}
}

By the way, fieldname is a terrible name for a form control.

Finally, for a discussion on this navigation technique, please read
(<URL:http://groups.google.com/groups?threadm=da7e68e8.0409171356.25f6eca9%40post ing.google.com>).

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #4
In article <cl**********@sun-cc204.lut.ac.uk>, sm*******@yahoo.com
enlightened us with...

Moreover, you can get the value of the selected item directly - no need
to go through the index.

This code works in Safari, IE and Mozilla:

function openDir(form) {
if (document.form.fieldname.selectedIndex != 0)
cururl = document.form.fieldname.value;


I remember that there was a browser (or browsers?) that this didn't work with
because I stopped using it and reverted to using the fully qualified value
with the options. Perhaps Netscape 4?
I'd love to verify that it works in IE6 (windows and Mac), Netscape 6+,
Firefox/Mozilla, Opera, Safari, and Konqueror...anyone test it in all those?
The longhand is such a PITA...

--
--
~kaeli~
User: The word computer professionals use when they mean
'idiot'.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #5
Hello everybody,
I just wanted to take the time to thank you all for your help and
suggestions. I'm pretty sure I got it to work now, but if you
wouldn't mind double checking for me, the address is
http://www.pictronicaenterprises.com/photography.htm

In anycase,
Have a great day,
Christopher Walsh
Pictronica Enterprises
http://www.pictronicaenterprises.com

kaeli <ti******@NOSPAM.comcast.net> wrote in message news:<MP***********************@nntp.lucent.com>.. .
In article <cl**********@sun-cc204.lut.ac.uk>, sm*******@yahoo.com
enlightened us with...

Moreover, you can get the value of the selected item directly - no need
to go through the index.

This code works in Safari, IE and Mozilla:

function openDir(form) {
if (document.form.fieldname.selectedIndex != 0)
cururl = document.form.fieldname.value;


I remember that there was a browser (or browsers?) that this didn't work with
because I stopped using it and reverted to using the fully qualified value
with the options. Perhaps Netscape 4?
I'd love to verify that it works in IE6 (windows and Mac), Netscape 6+,
Firefox/Mozilla, Opera, Safari, and Konqueror...anyone test it in all those?
The longhand is such a PITA...

--

Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1879
by: kevin | last post by:
hi there I am struggling with javascript. Can you please help me I've managed to get the get URL in flash to open a html that has the function that opens the Feedback form I want. I Couldn't...
5
2043
by: TrvlOrm | last post by:
HI There, I have been struggling with JavaScript code for days now, and this is my last resort! Please help... I am trying to create a JavaScript slide show with links for Next Slide,...
5
2261
by: TrvlOrm | last post by:
Can any one please help me...I am new to JavaScript and I have been struggling with this code for days now and can't figure it out. I would like to get the Buttons to correspond with the action...
7
3570
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title>...
11
1894
by: milkyway | last post by:
Hello, I have an HTML page that I am trying to import 2 .js file (I created) into. These files are: row_functions.js and data_check_functions.js. Whenever I bring the contents of the files into...
7
1691
by: Tigger | last post by:
Dear Experts, I am working on ASP.NET. I have got a problem related to the usage of Javascript in ASP.NET. Please help. The story is the following: 1) I am developing an ASP.NET application. I...
1
9584
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
5
2574
by: settyv | last post by:
Hi, Below is the Javascript function that am trying to call from asp:Button control. <script language="javascript"> function ValidateDate(fromDate,toDate) { var fromDate=new Date();
9
3985
by: mevryck | last post by:
Greetings I have a huge Javascript with inclusion of external scripts and all. I got this by doing a XSLT . Now I have the contents in a Javascript variable, but I'm not able to update the...
5
2672
by: loveshack | last post by:
Can anyone help me please (i am quite a novice, but having fun learning). Im not sure if this is an ASP problem, a javascript problem or a browser problem. Firstly, everything i have written...
0
7188
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7063
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7258
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6970
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5558
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4987
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4663
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3146
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.