Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Old 09-13-2004, 06:43 AM Using 2 functions!
Experienced Talker

Posts: 37
Trades: 0
Im using Javascript and want 2 functions - however with the following code

only one works!!



Code:
 

<script language = "JavaScript">

<!--

function mail() {

var theFields = document.concernform.elements;

var x = theFields["MyTeacher"].value;

if (x == "Other (Support Staff etc)")

theFields["MyEmail"].value = "";

else

if (x == "AAS - Mr A Adams")

theFields["MyEmail"].value = "aadams@wickersley.net";

}

function headmail() {

var theFields = document.concernform.elements;

var y = theFields["MyDepartment"].value;

if (y == "Careers")

theFields["MyHeademail"].value = "Careers";

else

if (y == "Maths")

theFields["MyHeadmail"].value = "Maths";

}

 

//-->

</script>




Any ideas why??

Thanks!
woody22 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-14-2004, 02:50 AM
Ultra Talker

Posts: 377
Trades: 0
and which one works???
__________________
andrews_john

Please login or register to view this content. Registration is FREE
andrews_john is offline
Reply With Quote
View Public Profile Visit andrews_john's homepage!
 
Old 09-14-2004, 06:30 AM
Skilled Talker

Posts: 72
Trades: 0
Unlesss you want one function to run straight into the other after calling the first one....?
In which case you need to call the second one to run (provided that ran the first one..).

Assuming this is the case, why not this?

Code:

<script language = "JavaScript">

<!--

function mail() {

var theFields = document.concernform.elements;

var x = theFields["MyTeacher"].value;

if (x == "Other (Support Staff etc)")
{
theFields["MyEmail"].value = "";
}
else

if (x == "AAS - Mr A Adams")
{
theFields["MyEmail"].value = "aadams@wickersley.net";
}

headmail();
}

function headmail() {

var theFields = document.concernform.elements;

var y = theFields["MyDepartment"].value;

if (y == "Careers")

theFields["MyHeademail"].value = "Careers";

else

if (y == "Maths")

theFields["MyHeadmail"].value = "Maths";

}

 

//-->

</script>

Last edited by BravoGolf; 09-14-2004 at 06:49 AM..
BravoGolf is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Using 2 functions!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11497 seconds with 12 queries