473,395 Members | 1,379 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,395 software developers and data experts.

check box changing font decoration

kestrel
1,071 Expert 1GB
i have this
Expand|Select|Wrap|Line Numbers
  1. <pre>
  2. I)   stuff
  3. <label>       stuff    <input type="checkbox" name="1" /></label>
  4. <label>       stuff    <input type="checkbox" name="2" /></label>
  5. II)  stuff
  6. <label>       stuff    <input type="checkbox" name="3" /></label>
  7. <label>       stuff    <input type="checkbox" name="4" /></label>
  8. III) stuff
  9. <label>       stuff    <input type="checkbox" name="5" /></label>
  10. <label>       stuff    <input type="checkbox" name="6" /></label>
  11. </pre>
  12.  
and i want a <s> tag to be added to each line if the check box is checked at the end of each like
how would i accomplish this?

thanks
Mar 7 '07 #1
5 4094
acoder
16,027 Expert Mod 8TB
What's an <s> tag?

To change anything in the DOM, you will need to set an id to your elements.

Also, if you are using <pre> tags, the checkboxes will not display.
Mar 7 '07 #2
kestrel
1,071 Expert 1GB
they displayed for me, im not too worried about validation or anything, just something quick
basically i want the text to the left of the checkbox to change to style="text-decoration:line-through" when the check box is checked
Mar 8 '07 #3
iam_clint
1,208 Expert 1GB
Expand|Select|Wrap|Line Numbers
  1. <pre>
  2. I)   stuff
  3. <label id="l1">      stuff    </label><input type="checkbox" name="1" onclick="if (this.checked) { document.getElementById('l1').innerHTML = '<s>' + document.getElementById('l1').innerHTML + '</s>'; } else { var tmp=document.getElementById('l1').innerHTML; tmp = tmp.replace(/<s>/gi, ''); tmp = tmp.replace(/<\/s>/gi, ''); document.getElementById('l1').innerHTML = tmp; }">
  4. <label id="l2">       stuff    </label><input type="checkbox" onclick="if (this.checked) { document.getElementById('l2').innerHTML = '<s>' + document.getElementById('l2').innerHTML + '</s>'; } else { var tmp=document.getElementById('l2').innerHTML; tmp = tmp.replace(/<s>/gi, ''); tmp = tmp.replace(/<\/s>/gi, ''); document.getElementById('l2').innerHTML = tmp; }" name="2" />
  5. II)  stuff
  6. <label id="l3">       stuff    </label><input type="checkbox" onclick="if (this.checked) { document.getElementById('l3').innerHTML = '<s>' + document.getElementById('l3').innerHTML + '</s>'; } else { var tmp=document.getElementById('l3').innerHTML; tmp = tmp.replace(/<s>/gi, ''); tmp = tmp.replace(/<\/s>/gi, ''); document.getElementById('l3').innerHTML = tmp; }" name="3" />
  7. <label id="l4">       stuff    </label><input type="checkbox" onclick="if (this.checked) { document.getElementById('l4').innerHTML = '<s>' + document.getElementById('l4').innerHTML + '</s>'; } else { var tmp=document.getElementById('l4').innerHTML; tmp = tmp.replace(/<s>/gi, ''); tmp = tmp.replace(/<\/s>/gi, ''); document.getElementById('l4').innerHTML = tmp; }" name="4" />
  8. III) stuff
  9. <label id="l5">       stuff    </label><input type="checkbox" onclick="if (this.checked) { document.getElementById('l5').innerHTML = '<s>' + document.getElementById('l5').innerHTML + '</s>'; } else { var tmp=document.getElementById('l5').innerHTML; tmp = tmp.replace(/<s>/gi, ''); tmp = tmp.replace(/<\/s>/gi, ''); document.getElementById('l5').innerHTML = tmp; }" name="5" />
  10. <label id="l6">       stuff   </label> <input type="checkbox" onclick="if (this.checked) { document.getElementById('l6').innerHTML = '<s>' + document.getElementById('l6').innerHTML + '</s>'; } else { var tmp=document.getElementById('l6').innerHTML; tmp = tmp.replace(/<s>/gi, ''); tmp = tmp.replace(/<\/s>/gi, ''); document.getElementById('l6').innerHTML = tmp; }" name="6" />
  11. </pre>
  12.  
this code is lame but i'm tired

thats 1 very messy way to do it
Mar 8 '07 #4
acoder
16,027 Expert Mod 8TB
To change anything in the DOM, you will need to set an id to your elements.
Actually, to correct myself, you can use getElementsByTagName() to get all elements with the specified tag name.
Mar 8 '07 #5
kestrel
1,071 Expert 1GB
thanks alot!
works perfectly
you're the man
Mar 9 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Shmuel (Seymour J.) Metz | last post by:
I've got a document that StarOffice converted into HTML, and I'm trying to clean up the cuft that it generated. I put together some basic styles, and tied using them: the results are puzzling. The...
7
by: Daniel Kaplan | last post by:
I have the item below at the top of my style sheet. And it seems that the font-szie is ignored. I know that my linked style sheet is being read, and used because if I remove the font-family line,...
15
by: phillip.s.powell | last post by:
<style> div div table tr td a.navbar, div div table tr td font {display: none;} </style> <div class="navigationbar" style="background-color:Black; position: absolute; left:50%; top:127px;...
23
by: Schannah | last post by:
I'm trying to create a design which mimics the Radiohead website in the action on this page, but the problem is that they use PHP for the effect and I have no idea about PHP. I'm very amateur: fairly...
3
by: isoquin | last post by:
I'm working with the following code, trying to change the color of the links inside the divs. While the background color and border change exactly as they're supposed to, the text/link color itself...
1
by: =?Utf-8?B?Um9iZXJ0IFNtaXRo?= | last post by:
Hi, I have a repeater control with rows in made of of link buttons so that they react to a click as below: <div> <ASP:Repeater id="rptUserList" runat="server"...
2
by: jkizmannRU09 | last post by:
I know how to adjust the look of visited links with a CSS stylesheet, but how would one create individual variations among a set of links? For example, say I have three links, all initially...
2
by: kheitmann | last post by:
OK, so I have a blog. I downloaded the "theme" from somewhere and have edited a few areas to suit my needs. There are different font themes within the page theme. Long story short, my "Text Posts"...
4
pradeepjain
by: pradeepjain | last post by:
i have a menu of 4 items.all text color is white. and when i click a menu link the other menu items text color should change to black! Is it possible to do with css or javascript help is needed for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...

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.