me_patrick
asked on
Trying to use an input type 'button' within and anchor point with IE8 - doesn't work?
Can anyone tell me how to make this little snipet work in IE - it works in FF, Chrome & Safari. Have I got to redo this with an image?
<div>
<a href="list.php" title="Return to list without updating anything">
<input name="cancel" type="button" id="cancel" value="Cancel" /></a>
</div>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yep.
http://www.rodsdot.com/php/testButton.htm
Passes validation. e.g. the button inside the anchor doesn't violate the recommendation.
You get different behavior in IE and FF. In IE the button event fires and that's the end of it. In FireFox the button fires first and then the event bubbles up to the anchor and fires it as well.
Curious....wonder what bad things I can do with this.
http://www.rodsdot.com/php/testButton.htm
Passes validation. e.g. the button inside the anchor doesn't violate the recommendation.
You get different behavior in IE and FF. In IE the button event fires and that's the end of it. In FireFox the button fires first and then the event bubbles up to the anchor and fires it as well.
Curious....wonder what bad things I can do with this.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Button In An Anchor</title>
<script type="text/javascript">
function doButtonClick() {
if (window.event) {
alert('No, I won\'t go');
}else{
alert('okay');
}
}
</script>
</head>
<body>
<p>1 <a href="#bottom"><input name="cancel" title="Return to list without updating anything" type="button" id="cancel" value="Goto The Bottom Of The Page" onclick="doButtonClick();"></a></p>
<p>2<br>
3<br>
4<br>
5<br>
6<br>
7<br>
8<br>
9<br>
10<br>
11<br>
12<br>
13<br>
14<br>
15<br>
16<br>
17<br>
18<br>
19<br>
20<br>
21<br>
22<br>
23<br>
24<br>
25<br>
26<br>
27<br>
28<br>
29<br>
30<br>
<a name="bottom"></a></p>
</body>
</html>
validation.jpg
Rod,
Very nice analysis.
Very nice analysis.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great response guys - thanks very much. I've spread the points out as fairly as possible - I gave kadaba the most as this was the solution I used and even though Rod said he didn't want any points I awarded him some anyway as I found the contribution very helpful and illuminating,
Thanks to everybody who took an interest.
Regards.
Patrick.
Thanks to everybody who took an interest.
Regards.
Patrick.
Moved the demo page to http://www.rodsdot.com/php/testButton.php for posterity.
ASKER