473,500 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Onclick change in javascript

89 New Member
Hi'

I have a little problem with the onclick event. I have an image that i use as a button. When i click this image/button some text appears and a new image/button also appears. when i then click the new image/button the text should disapper again.

I have gotten so far as to getting the text to appear, but can't quite figure out how to make it disappear again, with the new button.

Please help, thank You.

Here is my code:

[HTML]<script>
function MakeVisible()
{
document.all.DivId1.style.display='';
}
</script>

<img src="advsearchturnon.gif" border="0" onclick="MakeVisible()" name="search" ONMOUSEDOWN="document.images['search'].src='advsearchturnoff.gif'" />

<div id="DivId1" style="display:none;">
<table>
<tr>
<td>With any of the words/numbers:</td>
<td><input name="search" type="text" size="20" /></td>
<td><img src="seperator.gif" width="1" height="110" /></td>
<td><b>A combination of:</b>
<br /><input name="jobnbr" type="checkbox" value="" />Job Nbr.<br /><input name="PO Nbr." type="checkbox" value="" />PO Nbr.<br /><input name="Part Nbr." type="checkbox" value="" />Part Nbr.<br /><input name="Ship Via" type="checkbox" value="" />Ship Via</td>
<td><img src="seperator.gif" width="1" height="110" /></td>
<td><b>Lines to display:</b><br />
<select name="lines" size="1">
<option selected="selected">10 per page</option>
<option>15 per page</option>
<option>25 per page</option>
<option>50 per page</option>
<option>75 per page</option>
<option>100 per page</option>
</select>
<br />
<b>Show results by:</b><br />
<select name="lines" size="1">
<option selected="selected">Job Nbr.</option>
<option>PO Nbr.</option>
<option>Part Nbr.</option>
<option>Ship Via</option>
<option>Tracking Nbr.</option>
</select> </td>
<td><img src="seperator.gif" width="1" height="110" /></td>
<td><img src="search.gif" /></td>
</tr>
<tr>
<td>With the exact phrase/number:</td>
<td><input name="search" type="text" size="20" /></td>
</tr>
</table>
</div>[/HTML]
Apr 2 '07 #1
3 2571
acoder
16,027 Recognized Expert Moderator MVP
Don't use document.all. use document.getElementById instead:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("DivId1").display=...
In the button that is displayed, just add an onclick that has the following:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("DivId1").display='none';
Apr 2 '07 #2
printline
89 New Member
Don't use document.all. use document.getElementById instead:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("DivId1").display=...
In the button that is displayed, just add an onclick that has the following:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("DivId1").display='none';
Could You perhaps elaborate a bit, i'm a quite new at javascript..... I tried adding document.getElementById("DivId1").display=('none') ; but that didn't work....

Also i can't have two onclick events in my button. What i have now, to make the button change is:

<img src="advsearchturnon.gif" border="0" onclick="MakeVisible()" name="search" ONMOUSEDOWN="document.images['search'].src='advsearchturnoff.gif'" />
Apr 2 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
Sorry, that was a mistake. It should be:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("divId1").style.display='none';
Apr 2 '07 #4

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

Similar topics

3
14887
by: GhislainTanguay | last post by:
Hi everyone. I'm not from Internet word i have some difficulties with events. I have a session variable who change the selected language (French or English) and i try to change this variable...
5
10755
by: Jim Bond | last post by:
Hello, I have found myself in the position of having to manage & "hack" a web site built by someone else. I am trying to make a modification to the javascript code and have been unable to get...
2
9138
by: Kevin Lyons | last post by:
Hello, Can anyone assist me with what I am trying to do with the following code (six different scenarios to try to make the functionality work correctly)? I want to always (and ONLY) display...
8
67447
by: KS | last post by:
Just to show some code to show the consept. <img id="date" onclick="javascript:show_calendar();" src="/PlexSysWeb/images/show-calendar.gif" width=20 height=18 border=0> What i want the...
3
5866
by: Byron | last post by:
Hi, Javascript confuses me, so I usually limit myself to Dreamweaver's built-in scripts for stuff like imageswaps. But this time I'm trying to write something very simple myself. I do most of my...
53
81655
by: usenet | last post by:
See <ul> <li><a name="link1" onClick="alert(this.name);return false;" href="#">Link1</a></li> <li><a name="link2" href="javascript:alert(this);">Link2</a></li> <li>Item 3</li> </ul> ...
2
3275
by: Sedef | last post by:
Hi, i'm trying to create a custom Button user control which will be derived from System.Web.UI.WebControls.Button. the normal server side Button class creates some client side javascript code for...
7
2772
by: extremerep | last post by:
My task is to change the value of a button and then make it functional with the onClick handler. Changing the value to "Play Again" works, but making the onClick work accordingly does not. The...
10
3556
by: apparker | last post by:
I'm creating a new GUI for a program and it is for a medical exam. There are so many different things to ask someone during a history it wastes too much space to make checkboxes for everything so I...
18
7725
by: wizdom | last post by:
Help - change text on click - text has another onclick inside with php variables ---------- I think what I'm trying to do is simple. I have a 2 buttons on a page. 1 button allows a thread of...
0
7180
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,...
0
7229
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...
1
6905
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...
0
7395
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
5485
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,...
0
4609
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...
0
3103
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
311
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...

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.