Can anyone help me with a JavaScript problem?
If you go to www.bidets4sale.com/test.htm you will see my webpage and if you right click on it you should be able to view the code.
I have two scripts but if you click on the top button (the button 1 script) it executes the button2 script.
How can I make both scripts work on the one page?
you must have two functions, validate(myButton1) and validates(myButton2), you can also create the situition in one funtion but you need a condition to it.
7 1553
How can I make both scripts work on the one page?
don’t use the same name for different functions.
"don’t use the same name for different functions". I don't think I have used the same name. Aren't "function validate(myButton1)" and "function validate(myButton2)" separate names or am I confused? How do you suggest I change it?
That's two functions with the same function name. They just have different names for the input varibles. Input variables are not part of the function name.
you must have two functions, validate(myButton1) and validates(myButton2), you can also create the situition in one funtion but you need a condition to it.
hi,baby.u functions define error.two functions[validate(myButton1) and validates(myButton2)] name and arguments totality is equal.the function validates(myButton2) will replace to the validate(myButton1).
so, button1 and button2 invoking validate(myButton2). -
-
<script language="javascript" type="text/javascript">
-
function validate(myButton1){
-
var myButton1= document.getElementById('myButton1');
-
var myDIV1= document.getElementById('DIV1');
-
setTimeout (function(DIV1){myButton1.style.display ='none'; },1);
-
setTimeout (function(DIV1){myDIV1.style.display ='inline'; },1);
-
}
-
</script>
-
<script language="javascript" type="text/javascript">
-
function validate(myButton2){
-
var myButton2= document.getElementById('myButton2');
-
var myDIV2= document.getElementById('DIV2');
-
setTimeout (function(DIV2){myButton2.style.display ='none'; },1);
-
setTimeout (function(DIV2){myDIV2.style.display ='inline'; },1);
-
}
-
</script>
-
my suggestion is right and its working, he can create that two function, - <script language="javascript" type="text/javascript">
-
function validate(myButton1){
-
var myButton1= document.getElementById('myButton1');
-
var myDIV1= document.getElementById('DIV1');
-
setTimeout (function(DIV1){myButton1.style.display ='none'; },1);
-
setTimeout (function(DIV1){myDIV1.style.display ='inline'; },1);
-
}
-
</script>
-
<script language="javascript" type="text/javascript">
-
function validates(myButton2){
-
var myButton2= document.getElementById('myButton2');
-
var myDIV2= document.getElementById('DIV2');
-
setTimeout (function(DIV2){myButton2.style.display ='none'; },1);
-
setTimeout (function(DIV2){myDIV2.style.display ='inline'; },1);
-
}
-
</script>
,
he can also create his situition in only one function by determining if the button that been click is button1 or button2. . . , I suggest he can use Jquery for easy coding,
gits 5,390
Expert Mod 4TB
if nothing else of jQuery is used in the page - then i strongly recommend to NOT use it for such simple things. its a complete useless overhead to have a complete lib included without the need for it. and its not 'easier' with jQuery - at best a bit more convenient. there is not need to fire a rocket on a mosquito.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Tommo |
last post by:
Hello All,
I am a still learning so be easy on me. I am trying to get
some code to work that is using JS and Perl/CGI, I am using AS Perl
and an Apache Server on XP as the webserver. Can anyone...
|
by: Cardman |
last post by:
Greetings,
I am trying to solve a problem that has been inflicting my self
created Order Forms for a long time, where the problem is that as I
cannot reproduce this error myself, then it is...
|
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,...
|
by: ms_mmswan |
last post by:
I am trying to have multiple layers on a page that toggle on and off, it
works on a htm file but when I use it as an asp file it doesnt show
anything.
This is the javascript code that is...
|
by: kaston3 |
last post by:
I use screen.width to check escreen resolution and then document.write
to write different width tables accordingly. It all works OK with
Mozilla Firefox, however it seems that in IExplorer it only...
|
by: johnny15 |
last post by:
I have copied from a site a javascript code for my web site to create a
pop up. This works fine on older versions of browser but not the most
recent. Whilst I have been searching for some new code...
|
by: thatsMaBoy |
last post by:
Hi,
I am attempting to display a simple Javascript alert when a webpage
loads. It works on some pages but not on others. For example, the
following code does not produce an alert:
Code in...
|
by: ajos |
last post by:
hi frnds,
i have a form,which has 2 input text boxes, the values are entering the text boxes,when i leave the 2 text boxes blank and hit submit a java script gives the message that the 2 fields are...
|
by: supriyamk |
last post by:
Hi,
i am trying to copy files of a certain type into a different directory using perl,
The copy function doesnt seem to work.
my @dir_list;
my $sub_dir;
my $file_name1;
...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
| |