aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Netscape href issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Netscape href issue" Watch "Netscape href issue" New topic
Author

Netscape href issue

Matt Hoffman
Ranch Hand

Joined: Jun 03, 2004
Posts: 83
Anyone know why this won't work in Netscape, but it works in IE..
<a href="#"><html:submit styleClass="formButton" value="Login"/></a>

This is displayed in the page source.
<a href="#"><input type="submit" value="Login" class="formButton"></a>
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
why are you doing that in the first place?
Matt Hoffman
Ranch Hand

Joined: Jun 03, 2004
Posts: 83
This site is designed using the struts framework. I don't have much experience with struts, but it seems that this is a requirement for tiles.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
The Struts taglib is working correctly. That's what the resulting HTML should look like. I'd suggest removing the <a> tags completely -- you won't need them.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Matt Hoffman
Ranch Hand

Joined: Jun 03, 2004
Posts: 83
The <a> need to be in there for a mouse over effect..
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Originally posted by Matt Hoffman:
The <a> need to be in there for a mouse over effect..


What mouseover effect are you trying to achieve? I don't see any events attached to the code you posted above...
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

There's something fundamentally wrong with the idea of a submit button being embedded in a hyperlink. Both constructs are expected to transfer the browser somewhere else, and the do so under mutually incompatible rules.

If this is really a documented feature of IE, Microsoft's been playing fast and loose with specs again and you can expect not only Netscape/Mozilla, but Opera and every other non-MS web browser out there to fail the test as well.

If you really want a "submit button" that changes when you roll the mouse over it - and be friendly to the non-IE world, the traditional method is to use JavaScript and swap button images as the mouse rolls over/off the "button" and sensitize the image area to invoke a submitting function.


Customer surveys are for companies who didn't pay proper attention to begin with.
Matt Hoffman
Ranch Hand

Joined: Jun 03, 2004
Posts: 83
The issue that I am having is that we are NOT allowed to use javascript because of security reasons. The Java developers found a way to use the hover buttons using css without javascripting. I need to find a way to enable this in netscape without using any type of javascirpt language.

Any ideas?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
I think you are out of luck...

IE does some wird things and that is one of them....

Eric
Matt Hoffman
Ranch Hand

Joined: Jun 03, 2004
Posts: 83
Well the issue is not with IE, though..

In Netscape, I cannot click on the button. In IE this works. If I click on it in Netscape, nothing happens.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
The issue is with IE since it renders it, it does funky things that the other browsers do not do.

By you saying hat JavaScript is a "security issue" I am assuming hat all browsers have it disabled?

Eric
Matt Hoffman
Ranch Hand

Joined: Jun 03, 2004
Posts: 83
Oh ok.. I see your point.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61653
    
  67

The issue that I am having is that we are NOT allowed to use javascript because of security reasons.


This is a completely unrealistic requirement if you want any sort of client-side activity such as rollovers. And as you have seen, resorting to browser tricks will just make your code obfuscated, weird and prone to funky behavior.

Either use Javascript wisely, or eschew client-side activity.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
Technically the CSS2 pseudo-classes (e.g. :hover) can be applied to any HTML tag. I'm not convinced that you'll get much joy out of browser support for this however, but it might be worth trying:

with the associated CSS being something like:

I won't hold my breath while you test this. :roll:

As an aside, what's the point of that Struts html:submit tag? All it seems to do is obfuscate the HTML...

Jules
Matt Hoffman
Ranch Hand

Joined: Jun 03, 2004
Posts: 83
The CSS looks like:

A.formButton:hover
{background-color: #000099;
color: #FFFFFF;}
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
OK, I was curious so I took 5 minutes to try it out. Here's the rough test code:

Here's the results (surprising):

IE6 - has it's own rollover style for form buttons anyway which, IMHO, doesn't need adding to.
Link example works; DIV example exhibits default behaviour.
NN6.1 - I haven't got 7 on my PC
Link example underlines button text and hovering changes underline to white; DIV example shows background colour, but only when not hovering over button (i.e. hovering in DIV area next to it) D'oh!; default button exhibits no rollover behaviour
Opera 7.1 - Link example exhibits default behaviour (which is to highlight the submit button rather nicely IMHO); DIV example shows background colour when hovering in DIV area and even when hovering over the submit button.;
IE5.5 - Does absolutely naff all. Furrows its brow as if to say, "what's hover?" Not a flicker.

Conclusion: Either don't bother because the browsers don't do what you want to do consistently or create your own button image, whack a link around it and use javascript:myForm.submit(). You can then use CSS hover styling to your heart's content. I suppose you could always serve Netscape slightly different code (yuk).

That's my considered opinion. Hope it helps.

Jules
[ August 18, 2004: Message edited by: Julian Kennedy ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Netscape href issue