473,699 Members | 2,364 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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=TEXTcontro l 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 2187
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 bugRiddenCrashP ronePieceOfJunk = (
navigator.userA gent.indexOf('M SIE 5') != -1
&& navigator.userA gent.indexOf('M ac') != -1
) // Plone, register_functi on.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.javas cript 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
2429
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 in my CSS and tried to apply it to the table, doesn't work. I have tried to wrap the table in a div with the style. Doesn't work. I have tried the old-fashioned <font> tag, doesn't work. I must be doing something wrong. It works however if I...
3
1848
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() rtbData.SelectionFont = New Font(f, f.Style + (IIf(f.Bold, FontStyle.Bold * -1, FontStyle.Bold)))
1
6165
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 finger press.
1
2721
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, btnCalculate.Font.Style | FontStyle.Bold);
1
3979
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 someone please show me how to change the font programmatically? Thanks
3
1211
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 size is not changing. I have highlighted the problem area in the below snippet. // Start of the Snippet -------------------------------
2
1330
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 lstMain.SelectedItem.enabled? Dom
6
2855
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 font of Arial and 8.25pt. Great.
2
3172
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
2594
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 ... doc.ActiveWindow.Selection.SetRange(doc.Paragraphs(1).Range.Start, doc.Paragraphs(app.ActiveDocument.Paragraphs.Count()).Range.End) doc.ActiveWindow.Selection.Font.Bold = 1 doc.ActiveWindow.Selection.Font.Name = "Traditional Arabic" ...
0
8687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9174
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9035
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8914
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8884
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5875
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4376
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3057
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2009
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.