473,383 Members | 1,840 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,383 software developers and data experts.

REQ: help with event and inner tag.

.
TIA for your help with is quick question:

document.onkeyup=test;
document.onmousedown=test;

function test(evt){
myEvent=window.event?event.srcElement:evt.target;
alert(myEvent.href);
}

Works great for a link like:
<a href="http://www.google.com">Google</a>
The alert properly shows http://www.google.com.

However this:
<a href="http://www.google.com"><i>Google</i></a>
returns undefined. How can i get the href?

The <i> and it's placement is not my doing, I'm forced to deal with
it.

Thanks much,

Rick
Jul 23 '05 #1
1 1065
.
Just found my answer on msdn.com, here it is:

In IE
alert(myEvent.parentElement.href);

In Mozilla
alert(myEvent.parentNode.href);

HTH
On Tue, 10 Aug 2004 06:09:00 +0900, . <me@me.com> wrote:
TIA for your help with is quick question:

document.onkeyup=test;
document.onmousedown=test;

function test(evt){
myEvent=window.event?event.srcElement:evt.target;
alert(myEvent.href);
}

Works great for a link like:
<a href="http://www.google.com">Google</a>
The alert properly shows http://www.google.com.

However this:
<a href="http://www.google.com"><i>Google</i></a>
returns undefined. How can i get the href?

The <i> and it's placement is not my doing, I'm forced to deal with
it.

Thanks much,

Rick


Jul 23 '05 #2

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

Similar topics

2
by: John F Dutcher | last post by:
Can anyone comment on why the code shown in the Python error is in some way incorrect...or is there a problem with Python on my hoster's site ?? The highlites don't seem to show here...but line...
1
by: Covad | last post by:
Hi all, For some reason my change() function is only called when the page loads. I'd much rather it gets called when the select changes. Here's the code: window.onload = init; function...
4
by: Marc Tanner | last post by:
Hello, I am currently working on a eventhandling system or something similar, and have the problem of loosing scope. I have read many interesting posts on this group and the faq article about...
4
by: amaca | last post by:
In this slightly contrived (though small, complete and perfectly formed) example: public class Inner { public event EventHandler InnerHandler; public void DoSomething() { if ( InnerHandler...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
0
by: simon | last post by:
hello, relatively new to .net, i'm using vb.net and the 2.0 .net platform I'm trying to display a grid that has a text box on the left in one cell (with a hidden ID), which will be associated...
4
by: =?Utf-8?B?SmFtZXMgR2V1cnRz?= | last post by:
On my page, I have one repeater that contains a literal control and a nested repeater. The nested repeater contains a literal control. Both repeaters are databound with only one object (string). ...
7
by: =?Utf-8?B?cGF0cmlja2RyZA==?= | last post by:
Hi all! I have a gridview inside a datagrid (nested) for which (gridview) the rowcommand is not raised in order to delete a row from the grid! I also tried OnRowCommand="method", didn't work...
5
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.