By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,435 Members | 2,939 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,435 IT Pros & Developers. It's quick & easy.

Changing font-weight of a TEXT INPUT control

P: n/a
Is there a universally correct way to change the weight of the font in
an <INPUT TYPE=TEXTcontrol or do I have to use some trick, or even
browser sniffing to achieve the same result despite the browser?

I've been trying to get this working, but I need a different approach
between Opera and Firefox. I'm yet to get IE6 working.

My test page is at http://swiftys.org.uk/test.html but it's not working
in any browser right now following a suggestion to try jQuery (from a
work colleague). It's the controls at the bottom of that page; the
weight should change with the checkbox.

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk
Jan 25 '08 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Steve Swift wrote:
My test page is at http://swiftys.org.uk/test.html but it's not working
in any browser right now following a suggestion to try jQuery (from a
work colleague). It's the controls at the bottom of that page; the
weight should change with the checkbox.
Another hour, a different colleague, and my test page is now working
using prototype.

Now all I need to do is find a way to stop the TEXT box changing size
when its content changes between bold and normal weights.

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk
Jan 25 '08 #2

P: n/a
On Jan 26, 4:39*am, Steve Swift <Steve.J.Sw...@gmail.comwrote:
Steve Swift wrote:
My test page is athttp://swiftys.org.uk/test.htmlbut it's not working
in any browser right now following a suggestion to try jQuery (from a
work colleague). It's the controls at the bottom of that page; the
weight should change with the checkbox.

Another hour, a different colleague, and my test page is now working
using prototype.
You could have saved yourself half an hour by reading pr's response.
Using a library with 4,000+ lines of code to do what can be done in
one line doesn't seem a particularly good solution.

It seems a particularly bad solution given that Prototype.js is not
intended to be used in Opera, the browser you were having trouble with
in the first place.
--
Rob
Jan 25 '08 #3

P: n/a
RobG wrote:
On Jan 26, 4:39 am, Steve Swift <Steve.J.Sw...@gmail.comwrote:
>Steve Swift wrote:
>>My test page is athttp://swiftys.org.uk/test.htmlbut it's not working
in any browser right now following a suggestion to try jQuery (from a
work colleague). It's the controls at the bottom of that page; the
weight should change with the checkbox.
Another hour, a different colleague, and my test page is now working
using prototype.

You could have saved yourself half an hour by reading pr's response.
Using a library with 4,000+ lines of code to do what can be done in
one line doesn't seem a particularly good solution.

It seems a particularly bad solution given that Prototype.js is not
^^^^^^^^^^^^^^^^^^^
intended to be used in Opera, the browser you were having trouble with
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
in the first place.
It would seem that you are mistaken here. Since Prototype version 1.5.1 it
includes several branches to handle Opera specifically (it does that by
evaluating `window.opera' which in comparison to UA detection can at least
be considered reliable, even though testing for one object and using another
is as error-prone as it is unwise to augment built-in prototype objects like
Array.prototype).

Otherwise, full ACK.
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
Jan 25 '08 #4

P: n/a
Randy Webb wrote:
Forget you ever heard of jQuery for something this simple.
OK, Done. Made easier by the fact that my implementation using jQuery
didn't work in any browser (it was consistent, though)

Opera is a requirement, it's my primary browser.

So "prologue" to the rescue, courtesy of a work colleagues suggestion.
You can see the effect at http://swiftys.org.uk/test.html and so far it
has worked in every browser where I'd have any hope that it might work -
I forgave off-by-one.

If anyone has any ideas how to stop the text box changing size when the
font-weight changes, I'd be delighted to hear from you.

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk
Jan 26 '08 #5

P: n/a
Steve Swift said the following on 1/26/2008 3:01 AM:

<snip>
If anyone has any ideas how to stop the text box changing size when the
font-weight changes, I'd be delighted to hear from you.
Use CSS and define a width for the input. Then it doesn't change size
when you change font-weight.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 26 '08 #6

This discussion thread is closed

Replies have been disabled for this discussion.