Disable/enable icon.gif
Hi all.
I have this form in the page.htm: -
<form action="form.asp" method="post" onsubmit="return(validateForm(this));">
-
-
<select size="1" name="t_im" onchange="Form()">
-
<option value="">Select value</option>
-
<option value="A">A</option>
-
<option value="C">C</option>
-
<option value="Ca">Ca</option>
-
<option value="Cav">Cav</option>
-
</select>
-
-
<input type="text" name="e_gu" size="10" readonly>
-
<a href="javascript:Form()">
-
<img src="icon_1.gif" border="0"></a>
-
-
<select size="1" name="c_fu">
-
<option value="">Select value</option>
-
<option value="YES">YES</option>
-
<option value="NO">NO</option>
-
</select>
-
-
<input type="text" name="c_ma" size="10" readonly>
-
<a href="javascript:Form()">
-
<img src="icon_2.gif" border="0"></a>
-
-
</form>
-
I need:
1) If select name="t_im" value is NULL ( "" ) disable icon_1.gif
2) If select name="t_im" value NOT is NULL ( "" ) enable icon_1.gif
3) If select name="c_fu" value is NULL ( "" ) OR value is "YES" disable icon_2.gif
4) If select name="c_fu" value is "NO" enable icon_2.gif
Can you help me ?
kind regards
viki
10 5090
Wether u need it as disabled or hidden.
Regards
Ramanan Kalirajan
Wether u need it as disabled or hidden.
Regards
Ramanan Kalirajan
I need disabled.
thanks x your reply
viki
I need disabled.
thanks x your reply
viki
just check, the selected value in the function. Give id to each and every object u use. Here is an example code
[HTML]<html>
<head>
<script type="text/javascript">
function doThis()
{
//alert("hai");
var x = document.getEle mentById('mySel ect').selectedI ndex;
alert(document. getElementById( 'mySelect').opt ions[x].value);
if(document.get ElementById('my Select').option s[x].value<1)
document.getEle mentById('myImg ').disabled=tru e;
}
</script>
</head>
<select id="mySelect" size="10" onclick="doThis ()">
<option value="0">Selec t a Value</option>
<option value="1">Selec t 1 Value</option>
<option value="2">Selec t 2 Value</option>
<option value="3">Selec t 3 Value</option>
</select>
<br/><br/><br/>
<img src="demo.jpg" id="myImg">
</html>
[/HTML]
By using this code I cant see the image disabling, same replaced by a text box is working. I hope disable property is not supported for Img. Instead of disabling u can use hidden property (my suggestion).
Regards
Ramanan Kalirajan
Sorry buy your example not working in my case: - <html>
-
-
<head>
-
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
-
-
<script type="text/javascript">
-
function doThis()
-
{
-
-
var x = document.getElementById('mySelect').selectedIndex;
-
alert(document.getElementById('mySelect').options[x].value);
-
-
if(document.getElementById('mySelect').options[x].value < 1)
-
document.getElementById('myImg').disabled=true;
-
}
-
</script>
-
-
-
</head>
-
-
<body>
-
-
<form action="form.asp" method="post" onsubmit="return(validateForm(this));">
-
-
<select id="mySelect" size="1" name="t_im" onchange="Form()" onclick="doThis()">
-
<option value="">Select value</option>
-
<option value="A">A</option>
-
<option value="C">C</option>
-
<option value="Ca">Ca</option>
-
<option value="Cav">Cav</option>
-
</select>
-
-
<input type="text" name="e_gu" size="10" readonly>
-
<a href="javascript:Form()">
-
<img id="myImg" src="icon_1.gif" border="0"></a>
-
-
<select size="1" name="c_fu">
-
<option value="">Select value</option>
-
<option value="YES">YES</option>
-
<option value="NO">NO</option>
-
</select>
-
-
<input type="text" name="c_ma" size="10" readonly>
-
<a href="javascript:Form()">
-
<img src="icon_2.gif" border="0"></a>
-
-
</form>
-
-
</body>
-
-
</html>
Sorry buy your example not working in my case: - <html>
-
-
<head>
-
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
-
-
<script type="text/javascript">
-
function doThis()
-
{
-
-
var x = document.getElementById('mySelect').selectedIndex;
-
alert(document.getElementById('mySelect').options[x].value);
-
-
if(document.getElementById('mySelect').options[x].value < 1)
-
document.getElementById('myImg').disabled=true;
-
}
-
</script>
-
-
-
</head>
-
-
<body>
-
-
<form action="form.asp" method="post" onsubmit="return(validateForm(this));">
-
-
<select id="mySelect" size="1" name="t_im" onchange="Form()" onclick="doThis()">
-
<option value="">Select value</option>
-
<option value="A">A</option>
-
<option value="C">C</option>
-
<option value="Ca">Ca</option>
-
<option value="Cav">Cav</option>
-
</select>
-
-
<input type="text" name="e_gu" size="10" readonly>
-
<a href="javascript:Form()">
-
<img id="myImg" src="icon_1.gif" border="0"></a>
-
-
<select size="1" name="c_fu">
-
<option value="">Select value</option>
-
<option value="YES">YES</option>
-
<option value="NO">NO</option>
-
</select>
-
-
<input type="text" name="c_ma" size="10" readonly>
-
<a href="javascript:Form()">
-
<img src="icon_2.gif" border="0"></a>
-
-
</form>
-
-
</body>
-
-
</html>
Sorry buy your example not working in my case: - <html>
-
-
<head>
-
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
-
-
<script type="text/javascript">
-
function doThis()
-
{
-
-
var x = document.getElementById('mySelect').selectedIndex;
-
alert(document.getElementById('mySelect').options[x].value);
-
-
if(document.getElementById('mySelect').options[x].value < 1)
-
document.getElementById('myImg').disabled=true;
-
}
-
</script>
-
-
-
</head>
-
-
<body>
-
-
<form action="form.asp" method="post" onsubmit="return(validateForm(this));">
-
-
<select id="mySelect" size="1" name="t_im" onchange="Form()" onclick="doThis()">
-
<option value="">Select value</option>
-
<option value="A">A</option>
-
<option value="C">C</option>
-
<option value="Ca">Ca</option>
-
<option value="Cav">Cav</option>
-
</select>
-
-
<input type="text" name="e_gu" size="10" readonly>
-
<a href="javascript:Form()">
-
<img id="myImg" src="icon_1.gif" border="0"></a>
-
-
<select size="1" name="c_fu">
-
<option value="">Select value</option>
-
<option value="YES">YES</option>
-
<option value="NO">NO</option>
-
</select>
-
-
<input type="text" name="c_ma" size="10" readonly>
-
<a href="javascript:Form()">
-
<img src="icon_2.gif" border="0"></a>
-
-
</form>
-
-
</body>
-
-
</html>
In the if condition u have kept the value as 1 itself change for ur value and try it out. But the thing I am not able to diable an image. Just try hiding it
Regards
Ramanan Kalirajan
acoder 16,027
Recognized Expert Moderator MVP
By disabling, do you mean that you want to disable the link?
By disabling, do you mean that you want to disable the link?
Yes, I disable the link href.
This is my solution on the problem, check please: -
-
<html>
-
-
<head>
-
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
-
-
<script type="text/javascript">
-
-
function CheckIcon1(ss){
-
var ok=false
-
if(ss.options[ss.selectedIndex].value==''){
-
document.getElementById('icon1').onclick=Function('return false')
-
document.getElementById('img_icon1').src='icon_1.gif'
-
}
-
else{
-
document.getElementById('icon1').onclick=Function('return true')
-
document.getElementById('img_icon1').src="icon_2.gif'
-
ok=true
-
}
-
return ok
-
}
-
-
function CheckIcon2(ss){
-
var ok=false
-
if(ss.options[ss.selectedIndex].value=='NO'){
-
document.getElementById('icon2').onclick=Function('return true')
-
document.getElementById('img_icon2').src='icon_1.gif'
-
ok=true
-
}
-
else{
-
document.getElementById('icon2').onclick=Function('return false')
-
document.getElementById('img_icon2').src='icon_2.gif'
-
}
-
return ok
-
}
-
-
-
function Form(theUrl, percSize)
-
-
{
-
-
var width = 400;
-
var height = 200;
-
var left = Math.floor((screen.width-width)/2);
-
var top = Math.floor((screen.height-height)/2);
-
-
window.open(theUrl,'popup','width='+width+',height='+height+',top='+top+',left='+left);
-
-
}
-
-
</script>
-
-
</head>
-
-
<body>
-
-
<form action="form.asp" method="post">
-
-
<select size="1" name="t_im" onchange="if(CheckIcon1(this))Form('test.htm', '');">
-
<option value="">Select value</option>
-
<option value="A">A</option>
-
<option value="C">C</option>
-
<option value="Ca">Ca</option>
-
<option value="Cav">Cav</option>
-
</select>
-
-
<input type="text" name="e_gu" size="10" readonly>
-
<a id="icon1" href="javascript:Form('test.htm')" onclick="return false">
-
<img id="img_icon1" src="icon_1.gif" border="0"></a>
-
-
<select size="1" name="c_fu" onchange="CheckIcon2(this);">
-
<option value="">Select value</option>
-
<option value="YES">YES</option>
-
<option value="NO">NO</option>
-
</select>
-
-
<input type="text" name="c_ma" size="10" readonly>
-
<a id="icon2" href="javascript:Form('test.htm')" onclick="return false">
-
<img id="img_icon2" src="icon_2.gif" border="0"></a>
-
-
</form>
-
-
</body>
-
-
</html>
-
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Alphonse Giambrone |
last post by:
I am trying to enable/disable a requiredfieldvalidator on the client side
and am generating an error.
I had found some documentation on validation which states that I should be
able to enable/disable validators on the client side.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/aspplusvalid.asp
According to it and the little other info I was able to find, the way to
accomplish what I want it to call...
|
by: Robert Ladd |
last post by:
Hi,
I'm trying to disable the asp.net calendar control from a javascript
function, but it doesn't disable the doPostBack.
To simplify the situation, assume a page with 4 controls. A dropdownlist, a
calendar control, a textbox and an update button. What I'm doing is
initially setting the button to disabled, the other 3 controls are enabled.
If any data is entered in the textbox, I want to disable the dropdownlist
and the calendar...
|
by: talal |
last post by:
How to check whether javascript is enable or disable in client browser.
Remeber i can check wheter browser client support javascript with
BrowserCapability class. But what if the client has disable from
security setting in a browser.
Tell me is there any class like browserCapability in asp.net to check
wheter javascript is enable or disable. Please dont tell me the html
way or do some javascript because i have to apply this code into...
|
by: RootSpy2006 |
last post by:
Hi All,
Problem Definition:
---------------------
Microsoft Wirelss Keyboard works in BIOS but does not work when booting into
windows.
Discovered Work-around:
-----------------------------
1.> Open Device Manager(The keyboard device will have an exclamation and
|
by: PamelaDV |
last post by:
I am wondering if there is a way to disable the "X" used to close the
Access application window? I know how to disable it for individual
forms, but I would like to disable it for the application in general
and force users to use a button on the switchboard to close (because I
run important code on the close of the database from that button).
Any ideas are always appreciated.
Thanks!
| |
by: Phoe6 |
last post by:
Hi all,
I am trying to disable the NIC card (and other cards) enabled in my
machine to test diagnostics on that card.
I am trying to disable it programmatic using python. I checked python
wmi and i could not find ways to disable/enable, (listing is however,
possible).
Where should I look for to enable/disable devices in python.
Thanks,
|
by: Pietro |
last post by:
Hi all,
First of all I'd like to thank you very very much ,as finally after many years of searching,I could find a code to disable/enable the shift key,but actually i cannot use the code as I'm very new to VBA,i tried to follow the instructions reported in the code,but i got no result,i still can use the shift key,can you explain in details how to use it correctly to enable/disable users from pressing shift key to view database windw?,the...
|
by: sebouh181 |
last post by:
I am writing to registry using javascript.
var wsh = new ActiveXObject("WScript.Shell");
var key = "HKLM\\Software\\Neos\\2.0\\LightMode\\my-script";
wsh.RegWrite (key, 1999, "REG_SZ");
when i run this javascript code in my HTML page the following warning message appears
An ActiveX control might be unsafe to interact with other parts of the page. Do you want to allow this interaction?
I want to remove this message.
|
by: Naushad |
last post by:
Hi all,
I am using the countinous form. I want to Enable/Disable the some
fields for perticular records as per the following condition when
open the form. I have written this code in "On Current Event". I go on
the perticular record its enable/dosable the following field for all
records. I have tried this code in "On Open Even" but there is no
effect.
Please help me to solve this problem.
|
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...
|
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...
| |
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...
|
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: 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?
| |