473,320 Members | 1,946 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Changing font-weight of a TEXT INPUT control

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
5 2170
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: François de Dardel | last post by:
I have a complete Intranet site with about 140 pages using Verdana as the basic font. How do I place a table (12 columns) with Arial instead of Verdana, only for that table. I have defined a style...
3
by: Sakharam Phapale | last post by:
Hi All, I am using a richTextBox control for text editing purpose. I have written following procedure which change the font style of richTextBox. Dim f as font = rtbData.selectionFont() ...
1
by: Kasey | last post by:
How do you change the row height in a data grid - I do not want to increase the height by changing my font size. My product is a touch screen so I have to make the row height large enought for a...
1
by: Henry Jones | last post by:
I found some code to change the font on a button to bold: private void btnBold_Click(object sender, System.EventArgs e) { btnCalculate.Font = new Font(btnCalculate.Font, ...
1
by: Randy | last post by:
I've got an ASP VS 2005 project. I'm trying to figure out how to programmatically change the font of a label. From memory, this was done easily in 2003, but the Font property is read-only. Can...
3
gomescoder
by: gomescoder | last post by:
HI TSDN Pals, I am trying to create an object to modify its colour, size, message attributes on the fly using OOP concept... Everything works fine with this code but the problem is the font...
2
by: Dom | last post by:
I often see a listbox in which certain items are grayed, indicating that the item is "there" but disabled. It's a very helpful feature. Can you do that in cSharp? I don't find...
6
by: andrew.ames | last post by:
Hi I have a pretty basic windows application created in Visual Studio 2005 and VB.NET. I set my Form's font to Arial 8.25pt, so when i added a label and a button they automatically have a...
2
by: Peter Oliphant | last post by:
I can read the Font^ of a Button(->Font). But how do I change the Font of a Button, or at least it's size? I'm programming using MS VC++ 2005 Express in /clr managed mode. Thanks!
1
by: hmkaddoura | last post by:
Hi All, Am trying to change the MS word font in my vb.net application by using the following code Dim sizo As Single = 14 ......
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.