Click to See Complete Forum and Search --> : Question About Link Buttons


bear
05-18-2003, 01:11 PM
I know the script for making link buttons, what I need to know is. Is it possibe to put two lines of text on one button?

Like.......

Bears Home Page
Where Life Is Good

Nevermore
05-18-2003, 01:22 PM
What do you mean - like this:


Visit my site
which is really good
and only started today (http://www.evernet.co.uk)

AdamGundry
05-18-2003, 01:30 PM
Do you mean a HTML <button> element?

http://www.w3.org/TR/html401/interact/forms.html#edef-BUTTON

Adam

bear
05-18-2003, 02:17 PM
This is what I was talking about. I can not get two lines on the button. Is it possible to do?

<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function goToURL() { window.location = "http://javascript.internet.com/new"; }
// End -->
</script>
</HEAD>

<BODY>
<form>
<input type=button value="Bears Home Page" onClick="goToURL()">
</form>
</BODY></HTML>

I would have posted an image of the button, but for somr reason they have the img thing turned off..... So I posted the code

AdamGundry
05-18-2003, 02:29 PM
You can do this:

<button onClick="goToURL()">Line 1<br>Line 2</button>

Adam

David Harrison
05-18-2003, 02:42 PM
Why not do something like this:

<input type="button" value="Line 1\nLine 2\nLine3">

AdamGundry
05-18-2003, 02:46 PM
Uh...because it doesn't work. The <button> element is designed for buttons with graphics/HTML formatting, whereas <input> only allows a limited range of formatting.

Adam

David Harrison
05-18-2003, 03:02 PM
What do you mean it doesn't work, if you put that code on an HTML page it will make a button (that doesn't do anything) with 3 lines of text on it.

brendandonhue
05-18-2003, 03:07 PM
No it really doesn't work, it just says Line 1\nLine 2\nLine3
on the button. \n does not create a new line on input type button.

Charles
05-18-2003, 05:40 PM
And bear's form will not do anything at all on one in ten browsers. But with a little adjustment all will be well...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<title>A Bear of an Example</title>
<form action="http://javascript.internet.com/new">
<div>
<button type="submit">Bears<br>Home<br>Page</button>
</div>
</form>

bear
05-19-2003, 12:41 AM
Hello Charles, you said the java script code I had would not work in one in ten browsers. Why?

I'm not questioning your statement my friend, you see I know nothing about java script and very little about HTML. (I got that script from a script website). But I'm trying to learn this stuff. It difficult at times being new to computers. But this cyber world and all its little mysteries just excites the proverbial brown stuff out of me.

Food and water will sustain the body, but knowledge is food for the soul..... the bear said that

PS: I tried your code, yours and the one Adam gave me both work. Thank you :)

web-eagle
05-19-2003, 12:55 AM
He’s probably referring to the current wisdom that says 10% of all browsers have javascript disabled for whatever reasons. Only pure HTML can hope to reach those poor lost souls.

Charles
05-19-2003, 05:06 AM
Some of those "poor lost souls" cannot use browsers with JavaScript because of disabilities. Some, like myself, are simply defending ourselves from having our windows resized.

bear
05-19-2003, 12:10 PM
Charles, ya lost me my friend. Disabilities? Windows Resized? Please explain!


The Early Bird Gets The Worm. Heck, it did not do the worm any good getting up early. Besides, I'm not a Bird, I don't eat worms. Think I'll just stay in bed........
the bear said that :)

Charles
05-19-2003, 06:52 PM
See http://www.w3.org/WAI/gettingstarted/.

Nevermore
05-20-2003, 01:11 AM
Basically, audio browser for the blind or specialized browsers for people who cannot use mice/keybords often do not support JavaScript.