473,395 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

please nobody who can help me with this simple script?

I'am new with javascritping not with programming. Is there nobody who can
help me with ths simple promblem? :) Please, please give me a hint.

Please help me with this script. I have two lists in my form. One to choose
a directory and one to choose a picture. The script bellow works perfect
without the directory choose function.
I tried to make the directory choose function myself but I did not succeed.
I think I made a mistake here: document.pic.src = picLocation[theChoice2] +
picFile[theChoice];

Please give me a hint or a solution.
Thanks!

the script:

function changePicture()
{
var picFile = new Array ("empty.gif", "01vk.gif", "02vk.gif", "03vk.gif",
"04vk.gif", "05vk.gif", "06vk.gif", "07vk.gif",
"08vk.gif", "09vk.gif", "10vk.gif"); //change filename

var picLocation = new Array ("", "pic/Gif thumbs vk/", "pic2/Gif thumbs
vk/", "pic3/Gif thumbs vk/",
"pic4/Gif thumbs vk/", "pic5/Gif thumbs vk/");
//change filelocation

/* txt addition
var picText = new Array ("", "Kaart 1", "Kaart 2", "Kaart 3", "Kaart 4",
"Kaart 5", "Kaart 6", "Kaart 7", "Kaart 8", "Kaart
9", "Kaart 10");

var selection = document.DropPicture.Picture.selectedIndex;
var selection2 = document.DropPicture.Directory.selectedIndex;
var theChoice = document.DropPicture.Picture.options[selection].value;
var theChoice2 = document.DropPicture.Directory.options[selection].value;
document.pic.src = picLocation[theChoice2] + picFile[theChoice];
document.all.picWords.innerText = picText[theChoice];

}
</SCRIPT>


Jul 20 '05 #1
3 2301
Hello

Try:
document.pic.src = picLocation[selection2] + picFile[selection];
Instead of:
document.pic.src = picLocation[theChoice2] + picFile[theChoice];

What you initially wrote will only work if theChoice2/theChoice will contain
numeric values who are ranged from 0 to picLocation.length-1

You cannot access 'picFile' with a non numeric index.

hope that helps
Elias
"Lodewijk van Haringhal" <di**********@echtniet.oo> wrote in message
news:3f***********************@news.xs4all.nl...
I'am new with javascritping not with programming. Is there nobody who can
help me with ths simple promblem? :) Please, please give me a hint.

Please help me with this script. I have two lists in my form. One to choose a directory and one to choose a picture. The script bellow works perfect
without the directory choose function.
I tried to make the directory choose function myself but I did not succeed. I think I made a mistake here: document.pic.src = picLocation[theChoice2] + picFile[theChoice];

Please give me a hint or a solution.
Thanks!

the script:

function changePicture()
{
var picFile = new Array ("empty.gif", "01vk.gif", "02vk.gif", "03vk.gif",
"04vk.gif", "05vk.gif", "06vk.gif", "07vk.gif",
"08vk.gif", "09vk.gif", "10vk.gif"); //change filename

var picLocation = new Array ("", "pic/Gif thumbs vk/", "pic2/Gif thumbs
vk/", "pic3/Gif thumbs vk/",
"pic4/Gif thumbs vk/", "pic5/Gif thumbs vk/");
//change filelocation

/* txt addition
var picText = new Array ("", "Kaart 1", "Kaart 2", "Kaart 3", "Kaart 4",
"Kaart 5", "Kaart 6", "Kaart 7", "Kaart 8", "Kaart 9", "Kaart 10");

var selection = document.DropPicture.Picture.selectedIndex;
var selection2 = document.DropPicture.Directory.selectedIndex;
var theChoice = document.DropPicture.Picture.options[selection].value;
var theChoice2 = document.DropPicture.Directory.options[selection].value;
document.pic.src = picLocation[theChoice2] + picFile[theChoice];
document.all.picWords.innerText = picText[theChoice];

}
</SCRIPT>

Jul 20 '05 #2
Hi Elias,

Thanks this works fine but now my choice is limited to the ammount of
entry's in the picLocation array. when there are 4 directories I can only
choose 4 pictures?

Can you help me with this?

Try:
document.pic.src = picLocation[selection2] + picFile[selection];
Instead of:
document.pic.src = picLocation[theChoice2] + picFile[theChoice];

What you initially wrote will only work if theChoice2/theChoice will contain numeric values who are ranged from 0 to picLocation.length-1

You cannot access 'picFile' with a non numeric index.

hope that helps
Elias
"Lodewijk van Haringhal" <di**********@echtniet.oo> wrote in message
news:3f***********************@news.xs4all.nl...
I'am new with javascritping not with programming. Is there nobody who can help me with ths simple promblem? :) Please, please give me a hint.

Please help me with this script. I have two lists in my form. One to choose
a directory and one to choose a picture. The script bellow works perfect
without the directory choose function.
I tried to make the directory choose function myself but I did not

succeed.
I think I made a mistake here: document.pic.src = picLocation[theChoice2] +
picFile[theChoice];

Please give me a hint or a solution.
Thanks!

the script:

function changePicture()
{
var picFile = new Array ("empty.gif", "01vk.gif", "02vk.gif",

"03vk.gif", "04vk.gif", "05vk.gif", "06vk.gif", "07vk.gif",
"08vk.gif", "09vk.gif", "10vk.gif"); //change filename

var picLocation = new Array ("", "pic/Gif thumbs vk/", "pic2/Gif thumbs
vk/", "pic3/Gif thumbs vk/",
"pic4/Gif thumbs vk/", "pic5/Gif thumbs vk/");
//change filelocation

/* txt addition
var picText = new Array ("", "Kaart 1", "Kaart 2", "Kaart 3", "Kaart 4",
"Kaart 5", "Kaart 6", "Kaart 7", "Kaart 8",

"Kaart
9", "Kaart 10");

var selection = document.DropPicture.Picture.selectedIndex;
var selection2 = document.DropPicture.Directory.selectedIndex;
var theChoice = document.DropPicture.Picture.options[selection].value;
var theChoice2 = document.DropPicture.Directory.options[selection].value; document.pic.src = picLocation[theChoice2] + picFile[theChoice];
document.all.picWords.innerText = picText[theChoice];

}
</SCRIPT>


Jul 20 '05 #3
Hello Lodewijk,

1)You can increase values in both arrays in a parallel manner
2)in the location's listbox option values you set values that are in
the range of its array.
<option value="0">loc1</option>
etc...
all the values returned now will be from 0 to arraySize even if there
are more items in the listbox than in the array.

Elias
"Lodewijk van Haringhal" <di**********@echtniet.oo> wrote in message news:<3f***********************@news.xs4all.nl>...
Hi Elias,

Thanks this works fine but now my choice is limited to the ammount of
entry's in the picLocation array. when there are 4 directories I can only
choose 4 pictures?

Can you help me with this?

Jul 20 '05 #4

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

Similar topics

4
by: Peter Afonin | last post by:
Hello, I installed osCommerce on Apache server. By default it sends out e-mails from the account 'nobody'. However, this option is turned off by the hosting provider. Is there a way to make it...
1
by: Sullivan | last post by:
When I run a CGI script (Python) with Python's CGIHTTPServer, it should run with the UID of the user 'nobody' (as the documentation says). But if I let the CGI script e.g. create a file, it...
3
by: Brian Piotrowski | last post by:
Hi All, I'm trying to run a simple query from an ASP page. I want the query to select each individual field in a table and compare it to another table. If the value doesn't exist, I want it...
0
by: Sjaakie | last post by:
Hi there, I'm trying to get HTML_ToPDF (3.3) running on en dedicated server, safe_mode enabled. Been trying for more than 2 days now, without success. Have similar script running on my own...
4
by: rigga | last post by:
Hi, I am relatively new to php and am currently working on a site where I need to use a collapsing menu system. I have written the code to do this however I am completely at a loss to do one...
87
by: expertware | last post by:
Dear friends, My name is Pamela, I know little about CSS, but I would like to ask a question I have an image on a web page within a css layer: <DIV ID=MyLayer STYLE = "position:...
118
by: 63q2o4i02 | last post by:
Hi, I've been thinking about Python vs. Lisp. I've been learning Python the past few months and like it very much. A few years ago I had an AI class where we had to use Lisp, and I absolutely...
4
by: Jason | last post by:
I'm troubleshooting a program that I didn't build, so forgive me on this one. It's called email.php, and it looks like a program that the original developer must have downloaded from somewhere. ...
4
by: Fro | last post by:
Hi, the operating system (Unix) considers a php-server as a user with name "nobody". For example, if my php-script saves a file uploaded by a user, the owner of the file will be "nobody". I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.