SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
-
Aug 26, 2006, 12:17 #1
- Join Date
- Nov 2005
- Posts
- 20
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Browser created button in <Anchor> with IE>?
Anyone know of a way to get IE to draw a clickable, workable button within an anchor tag?
<A HREF="javascript:[function]" TITLE="Click Button">
<BUTTON>Click this Button</BUTTON>
</A>
This seems to work in Netscape and Firefox but not in IE. The button shows but clicking it does nothing in IE as opposed to Netscape where the javascript function fires.
I've tried numerous approaches, putting the button within a <FORM></FORM> set, etc. Nothing seems to work in IE; all work in Netscape (have not tested all for Firefox).
<A HREF="javascript:[function]" TITLE="Click Button">
<FORM METHOD="link"><INPUT TYPE="submit", VALUE="Click this button"></FORM>
</A>
Currently the only way I can seem to get this to work is to create an image of the button and use...
<A HREF="javascript:[function]" TITLE="Click Button">
<IMG SOURCE="button.png" BORDER="0">
</A>
But making a picture of every button is tiring and not nearly as flexable, also the button does not highlight when you move over it as a generated button will.
Why can't Microsoft start charging for IE so everyone would switch to Firefox!
-
Aug 26, 2006, 14:37 #2
- Join Date
- May 2006
- Location
- Aurora, Illinois
- Posts
- 15,476
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
What you're going to want to do is put a span inside the anchor, give the span a class of "button" and then style the span to look like a button.
Why can't Microsoft start charging for IE so everyone would switch to Firefox!Save the Internet - Use Opera | May my mother rest in peace: 1943-2009
Dan Schulz - Design Team Advisor | Follow me on Twitter
SitePoint References: HTML CSS JavaScript | Become A Guru
WordPress SEO Checklist | What WordPress Plugins Do You Use?
Web Standards Curriculum | Image Free Equal Height Columns
-
Aug 26, 2006, 23:15 #3
- Join Date
- Nov 2004
- Location
- Ankh-Morpork
- Posts
- 12,158
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You have three choices:
- Use an <input type="button"> (or type="submit") and style it to look like a link anchor.
- Use an anchor and style it to look like a button.
- Use <button><a href="...">Click this button</a></button>
Birnam wood is come to Dunsinane
-
Aug 28, 2006, 12:41 #4
- Join Date
- Mar 2006
- Location
- Netherlands
- Posts
- 1,661
- Mentioned
- 7 Post(s)
- Tagged
- 1 Thread(s)
If you're running javascript from the link click, you might as well drop the anchor altogether:
<button onclick="myFunction();">Click me!</button>
-
Sep 14, 2006, 02:34 #5
- Join Date
- Sep 2006
- Posts
- 1
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
onclick="window.location=this.href;"
<a href=xyz" onclick="window.location=this.href;">
<input type="button" value="click me"/>
</a>
I believe this works for IE, because when you put an image inside an anchor,
IE will respond to onclicks, but not to hrefs!
Stewart
London, UK
Bookmarks