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?
7 1560 Dormilich 8,658
Recognized Expert Moderator Expert
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(myButt on1)" and "function validate(myButt on2)" separate names or am I confused? How do you suggest I change it?
Rabbit 12,516
Recognized Expert Moderator MVP
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(myButt on1) and validates(myBut ton2), 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(myButt on1) and validates(myBut ton2)] name and arguments totality is equal.the function validates(myBut ton2) will replace to the validate(myButt on1).
so, button1 and button2 invoking validate(myButt on2). -
-
<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
Recognized Expert Moderator Expert
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 take a look at
the code and tell me why I am getting Apache Server errors in the code
below (Part A), when I modify the code as shown in part B the errors
go but the JS does not run ??
Part A.
|
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 difficult to know what
is going on.
One of these Order Forms you can see here...
http://www.cardman.co.uk/orderform.php3
|
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, Previous Slide and Home Slide.
Is it possible for you to view my page and tell me what I am doing
wrong. I have looked at this page for hours and can't figure it out, I
|
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 hindering my asp page:
function MM_showHideLayers() { //v3.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if
((obj=MM_findObj(args))!=null) { v=args;
|
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 works when
I reload the page. I think it can be cache handling in IE.
I tried putting the javascript code in an extrenal js.file. Then i
tried calling that file with a random number (using time functions) eg.
mycode.js?nn=secondss; but it...
| |
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 to replace the
old code I have also learnt that the javascript will not always work
as it may not be enabled.
Therefore does anyone have some code that I could copy that will work
fine on all browser and if the javascript is not enabled.
...
|
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 webpage1 (note, this is the only VB code in the ASPNET
webpage, in other words, the rest is all HTML):
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
|
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 blank.....the problem now is when i leave the text boxes blank the message appears...and when i click ok...then instead of showing me the page its giving me an exception-->
type Exception report
message
description The server encountered an...
|
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;
my $file_name2;
my @file_list_gel;
my @file_list_res;
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |