473,405 Members | 2,187 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,405 software developers and data experts.

Multiple onClick="" actions?

1
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 3000
RamananKalirajan
608 512MB
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 Expert Mod 8TB
you are aware that a form’s action must be an URL?
Jun 29 '10 #3
RamananKalirajan
608 512MB
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
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...
1
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....
3
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...
21
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...
10
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...
7
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...
2
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...
2
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...
4
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?...
5
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
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
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...
0
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,...

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.