473,807 Members | 2,857 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiple onClick="" actions?

1 New Member
Hello,

I am using this code

Expand|Select|Wrap|Line Numbers
  1. <form style="display: none;" name="num1form" id="num1form" action="">
  2. <input type="image" name="1" id="num1" value="1" src="imgl/img_first_01.png" onclick="document.forms[0].action='javascript:ChangeNum1();'"/>
  3. </form>
What the above code does is change the action state, it allows me to have multiple image inputs which is great as I can define various inputs with different IDs.

However, this is used for one section of the page I happen to have another <form> with basically the same code but it's using num2 values, I'm not sure why but I can only using one of these
Expand|Select|Wrap|Line Numbers
  1. onclick="document.forms[0].action='javascript:ChangeNum1();'"


at a time, for one form only.

Is there anyone able to help me divide this, or make these onClick actions unique so they can be used in more than 1 form?

Thanks,
Keenan
Jun 28 '10 #1
3 3015
RamananKalirajan
608 Contributor
This code

Expand|Select|Wrap|Line Numbers
  1. document.forms[0].action='javascript:ChangeNum1();'
is having 0 in forms[] that should be changed according to the form no which it is placed

for ex:
Expand|Select|Wrap|Line Numbers
  1.    <form style="display: none;" name="num1form" id="num1form" action="">
  2.    <input type="image" name="1" id="num1" value="1" src="imgl/img_first_01.png" onclick="document.forms[0].action='javascript:ChangeNum1();'"/>
  3.    </form>
  4.  
  5. <form style="display: none;" name="num2form" id="num2form" action="">
  6.    <input type="image" name="2" id="num2" value="2" src="imgl/img_first_02.png" onclick="document.forms[1].action='javascript:ChangeNum1();'"/>
  7.    </form>
Thanks and Regards
Ramanan Kalirajan
Jun 29 '10 #2
Dormilich
8,658 Recognized Expert Moderator Expert
you are aware that a form’s action must be an URL?
Jun 29 '10 #3
RamananKalirajan
608 Contributor
Yes Dormilich I am aware but this guys has written the code works fine for him. I gave the suggestion how to do what he is asking for.

Thanks and Regards
Ramanan Kalirajan
Jun 29 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
167448
by: Jez | last post by:
Hi, I've created a function which opens a popup window containing a calendar. When a day is clicked, the date is entered into a text box on the parent page and the popup is closed. The link I'm using on the parent page is ... <a href="#" onClick="popupcal()">choose date</a>
1
2062
by: Chris Riesbeck | last post by:
I need to remove colors put on links with Javascript so that CSS hover works on uncolored links. Both background color and transparent turn off the hover effect, and null doesn't remove the color. I discovered that the empty string worked in IE 6, Mozilla 1.1 and Opera 7. But is that legal? If not, what is the right way? Here's a toy demo of the working page: <html><head><title>Example</title> <style type="text/css">
3
1382
by: Alias | last post by:
dynamically creating a number of thumbnails, which is working fine. However, they are supposed to call a function loadRightFrame when clicked, and I seem to be running into syntax problems. This code: pagecontent+='<img width="70" height="70" border="0" src="' + thumbArray + '" onClick="loadRightFrame(\"' + photoArray + '\")">' resolves to this:
21
3358
by: Evan Sussman | last post by:
Could any one give me an explenation of this error? I get it every once in a while, and it really is a pain. currently the code that I'm working with goes like this <script> <!-- var newwindow; function moviepopup(url) {
10
67777
by: Eric-Sebastien Lachance | last post by:
Hey there, I decided to just create a 100% height and width div that filled the space over a background header image, and add an onclick event to redirect to the my index... Doesn't seem to work in FireFox only, just in IE. Here's the code: <div id="headerimg"><div style="width: 100%; height: 100%; cursor: hand; cursor: pointer;" onclick="top.location.href('http://www.monamouchtim.com/');">&nbsp;</div></div>
7
3292
by: RFS666 | last post by:
Hello, I would like to use variables with a type in jscript.NET. I declare them as follows: var x : double = 5.03; This doesn't work in my script, that I write to the page in codebehind with "registerClientScriptBlock" as follows: string script = "<script language=jscript>"; script += "function test()";
2
8062
by: Peter | last post by:
Hi, this is the code, and new row and new cell generated ok, but why the onclick and onmouseover doen't work? Thank you in advance! <html> <head> <script language="javascript"> function inserttable() {
2
5148
by: Vincent van Beveren | last post by:
Hey everyone, I've looked for this and I wouldn't know what the best practice would be for solving the following problem. We use a BASE tag in our HTML pages. Now we have some links that use the <A HREF="#" onclick="...">Hello</Amethod to invoke a JavaScript. However, because of the BASE tag, when clicking a link containing only a # as 'href' it will load the root index.html file. What I want is it to do nothing and execute the...
4
23281
by: jodleren | last post by:
Hi all I have a file I open in a smaller window, like this: <a href="#" onclick="window.open.... but it also causes the main window to jump to the top. What have people done to avoid that? BR
5
8704
by: dangt85 | last post by:
Hello, I have the following page: ... <style type="text/css"> body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }
0
9720
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9599
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10626
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10372
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10374
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,...
0
9193
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, 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...
1
7650
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 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...
0
5546
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...
3
3011
bsmnconsultancy
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...

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.