473,604 Members | 2,618 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

OnClick in Div only works when user clicks text

I have a div with some text in it and an onclick event. The onclick
event only seems to fire when the user clicks the text.. not if they
click the blank part of the div. This is in IE 6.

The event is assigned in my JS.

What gives?

Mar 31 '06 #1
2 6475
Daniel,

I suggest that you post a small sample HTML file. I'd like to know
what's in the "blank part of the div" -- do you mean nonbreaking
spaces, ASCII codes, what? Once I see a sample, I should be able to
help you.

Stan Scott
New York City

Apr 1 '06 #2
Here is the HTML I'm using. It's pretty simple, clicking anywhere in
the "Search" div should do an alert('hi') but it only works when I
click on the text.

I have IE 6.0.2900
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>
<head>
<title>Untitled </title>
<style type="text/css">
<!--
div
{
margin: 5px;
}

..c1
{
clear:both;
}

..c2
{
float:left;
margin:10px;
}

..pane
{
overflow:hidden ;
display:none;
}

#pane-left
{
width:300px;
}

#pane-right
{
width:800px;
}

..sec-head
{
background-color: #FFEADA;
border-top: 1px solid #999999;
}

-->
</style>
</head>
<body>
<div class="banner"> <h1>Testing</h1></div>
<div class="c1" style="overflow :auto;">
<div class="c2" id="pane-left">
<div class="sec-head" id="searchhead "
onclick="alert( 'hi');">Search</div>
<div class="pane" id="searchpane" ><img alt="i"
src="testlong.j pg"/></div>
<div class="sec-head" id="mytrailshea d" >My Stuff</div>
<div class="pane" id="mypane"><im g alt="i"
src="testlong.j pg"/></div>
<div class="sec-head" id="edithead">E diting</div>
<div class="pane" id="editpane">< img alt="i"
src="testlong.j pg"/></div>

</div>
<div class="c2" id="pane-right">
<div class="sec-head" id="mainpane">
<span>Stuff</span>
<span style="text-align:right; width:50%;"><a
id="link-hide">Hide</a></span>
</div>
<div class="c1"></div>
<div class="sec-head" id="infopane">I nfo</div>
<div class="c1"></div>
</div>
</div>
</body>
</html>
st*****@gmail.c om wrote:
Daniel,

I suggest that you post a small sample HTML file. I'd like to know
what's in the "blank part of the div" -- do you mean nonbreaking
spaces, ASCII codes, what? Once I see a sample, I should be able to
help you.

Stan Scott
New York City


Apr 2 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
35216
by: Matt | last post by:
I created 3 hyperlinks, when the user click each link, it will change the color of the text of a link. For example, when user clicks Link1, text Link1 will become red color, but Link2 and Link3 unchange. Here's my attempts, any ideas?? <script language="javascript"> function changecolor (i) { document.i.fontcolor = red; }
5
10869
by: Mike | last post by:
In my previous post, I wrote: > ... > GOAL: (very simple) Provide a hyperlink which, when clicked, > calls a javascript function which opens a new URL. > ... > PROBLEM: The following code works fine if I click to open in > the same window, but if I click the browser option to open in a > new window, the new window tries to open the href URL (the > onClick function does get executed, but seems to be ignored). > ...
2
9155
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 in the status bar 'Symantec Corporation' whenever anyone mouses over (onMouseOver) my image or link OR when one clicks while holding the left mouse down (onClick) on the same image or link. Upon releasing the mouse (onMouseOut), the
0
3154
by: Diane Yocom | last post by:
I'm very new to ASP.Net and probably jumped in a little over my head, but... I'm trying to create a user control that will control navigation through my site. It's sortof like Amazon.com, where there are tabs at the top with "submenu" buttons showing below the selected tab. The data that defines the tabs and submenus is stored in an XML file and I'm using nested repeaters to build them dynamically. I've got it working pretty well, except...
13
5653
by: Chris | last post by:
I can create Javascript confirm message boxes during page creation, etc adding them to the button attributes (many good posts on this!). But how can I add this event after the button is pressed? I have created an Is_Dirty routine checking for field changes on my page then if the user clicks on the "exit" button I check for Is_Dirty = true and want to ask then "do you want to exit without saving?". It's a code behind where if the value of...
1
6289
by: OtisUsenet | last post by:
Hello, I have some onClick events in <a href...> elements, so they get called when a user clicks on a link. This works well, and looks like this: <a onclick="onLinkClick(123);" href="......">foo</a> Unfortunately, if a user opens the link in a new tab (e.g right click->open in new tab), my onLinkClick function does NOT get called.
5
13941
by: Stuart Shay | last post by:
Hello All I am working on ASP.NET 1.1 Custom Pager that allows a User to Enter a Number in a TextBox and go to the page selected. Since the OnClick Event does not work in ASP.NET 1.1 for a TextBox I want to use a hidden button to fire when the Onclick Event is fired for the TextBox.
12
9540
by: Andrew C | last post by:
Hi, folks. I've recently been doing a few simple tests and experiments. As a result, I've noticed that, in dealing with 'onclick', IE seems less able than Firefox to keep up with rapid clicking. In fact, Firefox seems to be able to keep up with me no matter how rapidly I click, whereas IE... well, doesn't! The following snippet of code demonstrates this (on my machine it does anyway):
2
1955
by: stevemtno | last post by:
I've got a problem with a web page I'm working on. I have 4 modules - one of them has 2 tabs, two of them have 4 tabs. When the user clicks on the tabs, the content below them changes. However, when the user clicks on the tab (any tab), the browser goes back to the top of the page (I'm assuming it's refreshing, I'm not sure). I'm attaching the JS code below, along with the 2-tab version of the module and its accompanying CSS. Any help will be...
0
7929
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
8419
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
8406
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
8065
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
8274
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 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...
1
5882
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
3906
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...
1
2433
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 we have to send another system
0
1262
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.