473,757 Members | 9,145 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Combining Two onClick JavaScript Actions

23 New Member
Hi:
(this is a dummy question, I know, but I tried many times and I cant)
I need to insert this javascript option inside the input, I can't insert any funtion in <head>

I've this two javascript:

Expand|Select|Wrap|Line Numbers
  1.  javascript:document.form.xrthistory.disabled=false 
  2. javascript:document.form.prevert.disabled=false
  3.  
and I need to put in one line inside a input type=radio, like this:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <input name="chkxrt" type="radio" value="1" onClick="javascript:document.form.xrthistory.disabled=false;document.this.prevrt.disabled=false">
  3.  
I tried with a semicolon but nothing happen.

Could anyone help me with this??

Thanks for any help
nico
Dec 12 '06 #1
8 9042
b1randon
171 Recognized Expert New Member
Hi:
(this is a dummy question, I know, but I tried many times and I cant)
I need to insert this javascript option inside the input, I can't insert any funtion in <head>

I've this two javascript:

javascript:docu ment.form.xrthi story.disabled= false
javascript:docu ment.form.preve rt.disabled=fal se


and I need to put in one line inside a input type=radio, like this:

<input name="chkxrt" type="radio" value="1" onClick="javasc ript:document.f orm.xrthistory. disabled=false; document.this.p revrt.disabled= false">

I tried with a semicolon but nothing happen.

Could anyone help me with this??

Thanks for any help
nico
Nico, without more info I would suggest doing a separate function to execute both lines. It looks nicer too. Something like this:
Expand|Select|Wrap|Line Numbers
  1. function myFn (val){
  2.      document.form.xrthistory.disabled=val;
  3.      document.this.prevrt.disabled=val;
  4. }
  5.  
and
Expand|Select|Wrap|Line Numbers
  1. <input name="chkxrt" type="radio" value="1" onClick="javascript:myFn(false);">
  2.  
Dec 12 '06 #2
iam_clint
1,208 Recognized Expert Top Contributor
or
Expand|Select|Wrap|Line Numbers
  1. <input name="chkxrt" type="radio" value="1" onClick="document.form.xrthistory.disabled=FALSE; document.this.prevrt.disabled=FALSE;">
  2.  
wirth the semicolon in the correct place
Dec 12 '06 #3
nkoriginal
23 New Member
Thanks for your help, but I tried the two ways and nothing happend
I paste again my code:


<input name="chkxrt" type="radio" value="1" onClick="javasc ript:document.f orm.xrthistory. disabled=FALSE; document.this.p revrt.disabled= FALSE;">

<input name="chkxrt" type="radio" value="0" onClick="javasc ript:document.f orm.xrthistory. disabled=TRUE; document.this.p revrt.disabled= TRUE;" checked></td>

<select name="xrthistor y" disabled>
<option value="select" selected="selec ted">Select</option>
<option value="no_overl ap">No overlap</option>
<option value="field_ma tch">Field Match</option>
<option value="planned_ overlap">Planne d Overlap</option>
</select>


<textarea name="prevrt" cols="25" rows="8" wrap="VIRTUAL" id="prevrt" onKeyUp=chkLeng th(this,"248") disabled ><%=prevrt%></textarea>


With this code when any user press YES, the onclick activate the dropdown menu and the textarea at same time.

If I use only this function in my radio input:
javascript:docu ment.form.xrthi story.disabled= FALSE

my dropdown menu works ok but my textarea NOT!

Do you have any idea how I can fix this problem??

Thank you
nico
Dec 12 '06 #4
jonavanmona
11 New Member
maybe because you didnt enabled it..

javascript:docu ment.form.xrthi story.disabled= FALSE;
document.form.p revrt.disabled= FALSE ;
Dec 14 '06 #5
acoder
16,027 Recognized Expert Moderator MVP
With this code when any user press YES, the onclick activate the dropdown menu and the textarea at same time.

If I use only this function in my radio input:
javascript:docu ment.form.xrthi story.disabled= FALSE

my dropdown menu works ok but my textarea NOT!

Do you have any idea how I can fix this problem??
I don't understand. Isn't that what it's supposed to do?! If you only enable your dropdown menu and not your textarea, that is exactly what will happen. The code that you pasted above this quote in your post with both xrthistory and prvrt (the textarea) enabled is correct. What exactly are you trying to achieve? Please explain in more detail.
Dec 15 '06 #6
nkoriginal
23 New Member
I don't understand. Isn't that what it's supposed to do?! If you only enable your dropdown menu and not your textarea, that is exactly what will happen. The code that you pasted above this quote in your post with both xrthistory and prvrt (the textarea) enabled is correct. What exactly are you trying to achieve? Please explain in more detail.
Hi,

Thanks to everybody to help me.

when somebody select YES (radio button) my textarea and my dropdown menu come active, if they select NO, my textarea and dropdown is inactive.

so, I need one radio button to active or desactive a: dropdown menu and textarea.

in this case, two onlick in one radio button.

thank you to everybody
nico
Dec 18 '06 #7
iam_clint
1,208 Recognized Expert Top Contributor
Heres an example i made up for you.
Expand|Select|Wrap|Line Numbers
  1. <input type="radio" name="r1" onclick="document.getElementById('ta').disabled = false; document.getElementById('se').disabled = false;">Yes <input type="radio" name="r1" onclick="document.getElementById('ta').disabled = true; document.getElementById('se').disabled = true;">No<br>
  2. <textarea id="ta" disabled="true">Test</textarea><br>
  3. <select id="se" disabled="true">
  4. <option>1</option>
  5. <option>2</option>
  6. <option>3</option>
  7. </select>
  8.  
Dec 18 '06 #8
nkoriginal
23 New Member
Heres an example i made up for you.
Expand|Select|Wrap|Line Numbers
  1. <input type="radio" name="r1" onclick="document.getElementById('ta').disabled = false; document.getElementById('se').disabled = false;">Yes <input type="radio" name="r1" onclick="document.getElementById('ta').disabled = true; document.getElementById('se').disabled = true;">No<br>
  2. <textarea id="ta" disabled="true">Test</textarea><br>
  3. <select id="se" disabled="true">
  4. <option>1</option>
  5. <option>2</option>
  6. <option>3</option>
  7. </select>
  8.  
thank you so much for your help!
The code is working perfect!

:D:D:

nico
Dec 26 '06 #9

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

Similar topics

5
6064
by: JackT | last post by:
Hi, I have the following SQL SELECT Table1.Col1, Table3.Col1 AS Expr1, COUNT(Table1.Col2) AS Col2_No, COUNT(Table1.Col3) AS Col3_No etc, FROM Table3 INNER JOIN Table2 ON Table3.Col1=Table2.Col1 RIGHT OUTER JOIN Table1 ON Table2.Col2=Table2.Col2 GROUP BY Table1.Col1, Table3.Col1
4
1746
by: David. E. Goble | last post by:
Hi All; I am trying to combine to picture galleries onto te one page. But its not quite working. Here is what I have so far. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Bow's and foggy's stored signatures</title> <script type="text/javascript">
3
2813
by: Stefan Finzel | last post by:
Hi what's the right way to add ONCLICK to a form button using javascript? <HTML>... <INPUT ID="RESET" NAME="RESET" TYPE="RESET" VALUE=" Reset ">No onclick is used here <SCRIPT TYPE="text/javascript">...
1
2342
by: devine | last post by:
Hi All, I have a form which checks which Submit button has been pressed and also shows a textarea dependant on an option selected. The problem I have is that when I include my "display text" code, all submit buttons appear to be disabled. However, when the "display text" is removed, the buttons function correctly. <%@ LANGUAGE="VBSCRIPT" %> <%response.buffer=true%> <script language="javascript">
9
3228
by: monomaniac21 | last post by:
hi all i want to use hyperlinks to 'load' content by changing the display of div tags. the problem i have is that unless i specify a href the anchor does not change the mouse pointer on hover even if display is set to block. it only look changes when there is a href there. but if i have a href there then when i click it will load the page, which i dont want. how can i get the anchor to look like a proper link where the users pointer...
1
1437
by: seven.reeds | last post by:
Hi, I have a "DIV" that has an onClick action that works. Under some corcumstances I have "P" and other tags with onClick actions in that DIV. My problem is that in the case where I have, say, several P tags with onClick actions in the DIV; when I click the P tag *both* of the onClick actions happen. This is happening in the latest Firefox and IE. It appears that the onClick actions are triggered (or at least handeld)
13
38605
by: alvin.yk | last post by:
Hi, Normally, a piece of code such as <a href="http://www.yahoo.com" onclick="alert('hello');return false;">link</a> will stop the browser from actually going to href's destination. However, this is not the case with the IE7 I am using. What has changed?
2
2189
by: peteinglastonbury | last post by:
I'd be most grateful if someone would help me. I hope I'm in the right forum (apologies if not) - I'm not sure whether my problem is CGI or Javascript related. I found a script called BatmoAudiopop.js which opens a pop-up browser window with an audio player when a link is clicked. Basically, it sets the right mime-type depending on the operating system and audio file type, then opens a window with the audio file (passed as a parameter) in...
2
1515
by: fran7 | last post by:
Hi, I wonder if anyone can see whats going wrong here. I have this line of asp and javascript and it works fine <a onmouseover="doTooltip(event,'<img src=&quot;<%=Server.URLPathEncode(rsCard("largeimage"))%>&quot; border=&quot;0&quot;><div class=&quot;tp2&quot;></div>' )" onmouseout="hideTip()" href="http://<%=rsCard("DefaultHeadline")%>" onclick="this.target='blank'"><img border="1px" src="<%=Server.URLPathEncode(rsCard("imageone"))%>" ...
0
9489
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
9298
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
9906
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
9885
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
8737
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
7286
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
5172
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
3399
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2698
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.