# Html ? buttons and links

**URL:** https://boards.straightdope.com/t/html-buttons-and-links/222264
**Category:** Factual Questions
**Created:** [January 2, 2004, 12:05pm UTC](https://boards.straightdope.com/t/html-buttons-and-links/222264 "2004-01-02T12:05:23Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![Declan](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@Declan](https://boards.straightdope.com/u/Declan)
#### Post date: [January 2, 2004, 12:05pm UTC](https://boards.straightdope.com/t/html-buttons-and-links/222264/1 "2004-01-02T12:05:23Z")

</div>

\<button name=“NYPOST” value=“submit” type=“submit”\> \<img src="/images/nypost.GIF" alt=“New York Post”\>\</button\>

Can some tell me, where I would put the url in the above to make the button actually work ?

a href does not wanna work on the above , so far that I have noticed.

Thanks

Declan

---

<div class="post-metadata">

### Author: ![netscape\_6](https://avatars.discourse-cdn.com/v4/letter/n/8c91f0/32.png) [@netscape\_6](https://boards.straightdope.com/u/netscape_6)
#### Post date: [January 2, 2004, 12:58pm UTC](https://boards.straightdope.com/t/html-buttons-and-links/222264/2 "2004-01-02T12:58:51Z")

</div>

If you want to make a limage a link the way to do it would be:

\<a href=“your link here”\>\<img src=“your pic here”\>\</a\>

---

<div class="post-metadata">

### Author: ![magog](https://avatars.discourse-cdn.com/v4/letter/m/fbc32d/32.png) [@magog](https://boards.straightdope.com/u/magog)
#### Post date: [January 2, 2004, 1:46pm UTC](https://boards.straightdope.com/t/html-buttons-and-links/222264/3 "2004-01-02T13:46:37Z")

</div>

If you are trying to have a link submit a form, your best bet is to use javascript.

\<form name=“myForm”\>  
form contents  
\<a href="#" onClick=“document.myForm.submit();”\>\<img src="/images/nypost.GIF" alt=“New York Post”\>\</a\>  
\</form\>

Note that if they have Javascript disabled, they won’t be able to submit the form.

[http://javascript.internet.com/forms/submit-link.html](http://javascript.internet.com/forms/submit-link.html)

---

<div class="post-metadata">

### Author: ![Declan](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@Declan](https://boards.straightdope.com/u/Declan)
#### Post date: [January 2, 2004, 1:58pm UTC](https://boards.straightdope.com/t/html-buttons-and-links/222264/4 "2004-01-02T13:58:24Z")

</div>

> [@](#):
>
> \*Originally posted by magog \*  
> \*\*If you are trying to have a link submit a form, your best bet is to use javascript.
> 
> \<form name=“myForm”\>  
> form contents  
> \<a href="#" onClick=“document.myForm.submit();”\>\<img src="/images/nypost.GIF" alt=“New York Post”\>\</a\>  
> \</form\>
> 
> Note that if they have Javascript disabled, they won’t be able to submit the form.
> 
> [http://javascript.internet.com/forms/submit-link.html](http://javascript.internet.com/forms/submit-link.html) \*\*

No , I may be using the wrong code, as per the example on the OP

But when I use netscape6 code , i get the gifs to show up and link to where I want , but not the look I want

The look I want , is the bottom button on the navigation bar, but so far I have not been able to get it to link

www.manticore.ca

Declan

---

<div class="post-metadata">

### Author: ![DoubleJ](https://avatars.discourse-cdn.com/v4/letter/d/67e7ee/32.png) [@DoubleJ](https://boards.straightdope.com/u/DoubleJ)
#### Post date: [January 2, 2004, 2:13pm UTC](https://boards.straightdope.com/t/html-buttons-and-links/222264/5 "2004-01-02T14:13:28Z")

</div>

Well, what’s the button supposed to do? There’s no form built into the frame that would do anything. It’ll help us come up with ideas if we know what you want to have happen.

---

<div class="post-metadata">

### Author: ![magog](https://avatars.discourse-cdn.com/v4/letter/m/fbc32d/32.png) [@magog](https://boards.straightdope.com/u/magog)
#### Post date: [January 2, 2004, 2:25pm UTC](https://boards.straightdope.com/t/html-buttons-and-links/222264/6 "2004-01-02T14:25:07Z")

</div>

OK - if you’re trying to use a button as a link, again you need to use JavaScript and the onClick event.

\<button onClick=“window.location=‘[http://www.nypost.com/](http://www.nypost.com/)’;”\>\<img src="/images/nypost.GIF" alt=“New York Post”\>\</button\>

This may send just that frame to the form - if it does, you just need to change “window.” to “window.parent.” (I believe).

[http://javascript.internet.com/buttons/button-link.html](http://javascript.internet.com/buttons/button-link.html)

[http://javascript.internet.com/](http://javascript.internet.com/) is a good source of JavaScript examples.

Or, you can just edit your graphics to look like buttons.

---

<div class="post-metadata">

### Author: ![Declan](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@Declan](https://boards.straightdope.com/u/Declan)
#### Post date: [January 2, 2004, 3:20pm UTC](https://boards.straightdope.com/t/html-buttons-and-links/222264/7 "2004-01-02T15:20:30Z")

</div>

> [@](#):
>
> \*Originally posted by magog \*  
> \*\*OK - if you’re trying to use a button as a link, again you need to use JavaScript and the onClick event.
> 
> \<button onClick=“window.location=‘[http://www.nypost.com/](http://www.nypost.com/)’;”\>\<img src="/images/nypost.GIF" alt=“New York Post”\>\</button\>
> 
> This may send just that frame to the form - if it does, you just need to change “window.” to “window.parent.” (I believe).
> 
> [http://javascript.internet.com/buttons/button-link.html](http://javascript.internet.com/buttons/button-link.html)
> 
> [http://javascript.internet.com/](http://javascript.internet.com/) is a good source of JavaScript examples.
> 
> Or, you can just edit your graphics to look like buttons. \*\*

Thanks Magog , I am mostly grooving now

The only thing that I am looking at that java site , is to target the frame that I want. Changing the window , to parent worked , which is great for the links that I had opening in new windows, now I just have to find out how to do the target=“Content” that I had in html code.

Thanks for all the replies so far

Declan

---

<div class="post-metadata">

### Author: ![magog](https://avatars.discourse-cdn.com/v4/letter/m/fbc32d/32.png) [@magog](https://boards.straightdope.com/u/magog)
#### Post date: [January 2, 2004, 4:09pm UTC](https://boards.straightdope.com/t/html-buttons-and-links/222264/8 "2004-01-02T16:09:17Z")

</div>

> [@](#):
>
> \*Originally posted by Declan \*  
> **The only thing that I am looking at that java site , is to target the frame that I want. Changing the window , to parent worked , which is great for the links that I had opening in new windows, now I just have to find out how to do the target=“Content” that I had in html code.**

“window.parent.content” should reference the frame “content” from the nav bar (the parent part references the top HTML document, and the content references the content frame within the top HTML document). “top.content” should work as well.

Again, note that this will not work if JavaScript is turned off. Making them button-like images and using the \<a href=“link”\>\<img src=“image” alt=“name”\>\</a\> (as **netscape 6** described) is more browser friendly.

And a pet peeve of mine - JavaScript is different from java. JavaScript is a client-side languange, java is a compiled language.

---

<div class="post-metadata">

### Author: ![micco](https://avatars.discourse-cdn.com/v4/letter/m/5f8ce5/32.png) [@micco](https://boards.straightdope.com/u/micco)
#### Post date: [January 2, 2004, 4:31pm UTC](https://boards.straightdope.com/t/html-buttons-and-links/222264/9 "2004-01-02T16:31:21Z")

</div>

> [@](#):
>
> \*Originally posted by magog \*  
> \*\*And a pet peeve of mine - JavaScript is different from java. JavaScript is a client-side languange, java is a compiled language. \*\*

And a pet peeve of mine: JavaScript is NOT a client-side language. You can write server-side Javascript (e.g. ASP). JavaScript is frequently used on the client-side because browser support for it is more ubiquitous than other client-side script engines like VBScript, but it’s not inherently or solely a client-side technology. You can write client-side applets in Java; does that make Java a client-side language?

---

<div class="post-metadata">

### Author: ![Bill\_H](https://avatars.discourse-cdn.com/v4/letter/b/a5b964/32.png) [@Bill\_H](https://boards.straightdope.com/u/Bill_H)
#### Post date: [January 3, 2004, 3:16am UTC](https://boards.straightdope.com/t/html-buttons-and-links/222264/10 "2004-01-03T03:16:26Z")

</div>

**micco** , your point is entirely accurate, and you’re clearly one who knows his stuff. However, I’m sure you’ll agree that in fact the vast majority of javascript programs are used on the client-side, and also that not all web servers natively support javascript. In fact the most-used one (apache on linux) doesn’t without a great deal of effort.

I’ve written CGI in bash, but I wouldn’t consider it a CGI language.

I do however agree that java can be considered as much a client-side language as a server-side one.

---

<div class="post-metadata">

### Author: ![micco](https://avatars.discourse-cdn.com/v4/letter/m/5f8ce5/32.png) [@micco](https://boards.straightdope.com/u/micco)
#### Post date: [January 3, 2004, 4:47am UTC](https://boards.straightdope.com/t/html-buttons-and-links/222264/11 "2004-01-03T04:47:36Z")

</div>

> [@](#):
>
> \*Originally posted by Bill H. \*  
> **However, I’m sure you’ll agree that in fact the vast majority of javascript programs are used on the client-side, and also that not all web servers natively support javascript.**

I was simply responding to a pedantic inaccurate comment. That poster was trying to make a fine-point distinction but made it incorrectly and I thought it was worth noting. I hope I’m not being pedantic myself, but I’ve seen the sudden clarity some coders get when they finally understand the distinction between the framework (e.g. ASP or CGI) and the language (e.g. VBScript or Perl) and the fact that the two are completely separate issues. Once they understand that separation, they look at design in a different way, and you can’t really do good design until you do. Personally, I’d never write server-side code in Javascript (though I’ve seen it done and had to fix it), but I think it’s worth spending the pixels to correct the original inaccuracy if it helps magog understand that distinction better.

Oh, and just to be responsive, I certainly do agree that the vast majority of Javascript is client side and that most web servers won’t support it natively (though they don’t support a lot of other things we tack on either).

---

<div class="post-metadata">

### Author: ![magog](https://avatars.discourse-cdn.com/v4/letter/m/fbc32d/32.png) [@magog](https://boards.straightdope.com/u/magog)
#### Post date: [January 3, 2004, 3:37pm UTC](https://boards.straightdope.com/t/html-buttons-and-links/222264/12 "2004-01-03T15:37:02Z")

</div>

True **micco** , I mispoke. I was refering to most common usage. You _could_ use JavaScript as server-side, just like you could use Java as client side. But if 99% of the usage happens on one framework, the language tends to _become_ the framework (I note that you do it yourself in your previous statement - ASP is a language, running on a windows IIS framework). It’s shorthand.  
Again, I guess it’s different levels of pedanticness.

---

<div class="post-metadata">

### Author: ![micco](https://avatars.discourse-cdn.com/v4/letter/m/5f8ce5/32.png) [@micco](https://boards.straightdope.com/u/micco)
#### Post date: [January 4, 2004, 4:14pm UTC](https://boards.straightdope.com/t/html-buttons-and-links/222264/13 "2004-01-04T16:14:49Z")

</div>

> [@](#):
>
> \*Originally posted by magog \*  
> \*\*(I note that you do it yourself in your previous statement - ASP is a language, running on a windows IIS framework). \*\*

ASP is not a language. That’s the whole point I was trying to make. ASP is an interface analogous to CGI. You can write ASP scripts in a variety of languages like VBScript, Perlscript, and Javascript and ASP provides the interface to the server and server-level objects like Session, Request and Response. There is no ASP syntax just like there is no CGI syntax. There is syntax in specific languages for dealing with the services and objects that ASP and CGI provide.

---

<div class="post-metadata">

### Author: ![LSLGuy](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/lslguy/32/5813_2.png) [@LSLGuy](https://boards.straightdope.com/u/LSLGuy)
#### Post date: [January 4, 2004, 5:17pm UTC](https://boards.straightdope.com/t/html-buttons-and-links/222264/14 "2004-01-04T17:17:08Z")

</div>

> [@](#):
>
> \*Originally posted by magog \*  
> \*\* … pedanticness. \*\*

\<ModeSelections\>  
&nbsp;&nbsp;&nbsp;&nbsp;\<UltraPedantic\>ON\</UltraPedantic\>  
\</ModeSelections\>

Shouldn’t that be _pedanticity_??

\<ModeSelections\>  
&nbsp;&nbsp;&nbsp;&nbsp;\<UltraPedantic\>OFF\</UltraPedantic\>  
\</ModeSelections\>

😃
