Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Button Text 1

Status
Not open for further replies.

Norman55

Programmer
Apr 27, 2006
48
GB
I am trying to wrap text on a button. Can anyone tell me if this is possible if so how ?
thanks
 
You can do it with javascript:

<BODY onLoad="document.Form1.m.value='Please Push\nThis Button'">
<form name=Form1>
<input type=button name="m" value="" >
</form>
</BODY>

The '\n' in Javascript will cause the line to wrap.

Or, you can do it with ASP code:

<%="<input type=button name=x value=""Please Push" & vbnewline & "This Button"" >"%>

 
With \n? Does that work? I don't think so.

For modern verions of common browsers ie6/ff2 etc, you may use &#x0a;
[tt] <input type="button" style="border:none" value="line one&#x0a;line two" />[/tt]

But that is not something one can take pride of doing due to robustness and compatibility. Check out also this korpela article for other facets.
 
or I think a carriage return in the button works.

<input type="button" value="line
line two"/>

[sub]____________ signature below ______________
The worst mistake you'll ever make is to do something simply the way you know how while ignoring the way it should be done[/sub]
 
Try it. The \n works when javascript is used to write the value on the button (actually, \r works as well).

The issue I have with using the &#x0a;is how it is displayed in browsers that don't support it.
 
what happens when javascript it disabled :) just a thought.

aside from all that why are we talking about this in the ASP forum? ;-)

[sub]____________ signature below ______________
The worst mistake you'll ever make is to do something simply the way you know how while ignoring the way it should be done[/sub]
 
Absolutley right. Not an ASP issue. Star to you.
 
Thanks mbiro :)

Norman55

All the suggestions are good. Didn't mean to draw away from them, but as we got to the forum is based on ASP and this really isn't a place to discuss a client level task. There is a HTML/CSS forum that would be much better for the task.

The essential need for this is to make sure things are clean and easily found by future or present members that have a similar problem to yours. Think of a a relational database as compared to the forums structure. If the management side of things allowed questions to be asked outside the bounds of the topic of the single forums then you would basically go back to a flat representation and cause massive issues with search capabilities, performance and down to earth user experience.

wow, went into that a bit far. I think you get it

[sub]____________ signature below ______________
The worst mistake you'll ever make is to do something simply the way you know how while ignoring the way it should be done[/sub]
 
This really should be asked in the HTML/CSS Forum, but I'll show you another way. Use the <button> tag. You can insert <br />.

Code:
<button value="buttonValue">line1<br />line2<br />line3<br /></button>



<.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top