473,320 Members | 2,107 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.

adding line-through style to a table row

I want that if user clicks in a checkbox, the strike-through effect applices
to current table row. I tried the following code in IE, but nothing happens.

Any idea ?

<table>
<tr><td><input type=checkbox onclick="cbonclick(this)"></td>
<td><input type=text value="Row 1" ></td>
<td><select><option>pine</option><option>orange</option></select></td></tr>

<tr><td><input type=checkbox onclick="cbonclick(this)"></td>
<td><input type=text value="Row 2"></td>
<td><select><option>apple</option><option>kiwi</option></select></td></tr>
</table>

<script>
function cbonclick(othis) {
othis.parentNode.parentNode.style.textDecoration=
othis.checked? 'line-through':'';
}
</script>

Jul 20 '05 #1
6 14978
"Andrus" <no****************@online.ee> writes:
I want that if user clicks in a checkbox, the strike-through effect applices
to current table row. I tried the following code in IE, but nothing happens.


You can't make strike-through (or any other text decoration) affect
input or select elements.

<input type="text" value="test" style="text-decoration:strike-through">
gives normal text in the textbox.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
DU
Lasse Reichstein Nielsen wrote:
"Andrus" <no****************@online.ee> writes:

I want that if user clicks in a checkbox, the strike-through effect applices
to current table row. I tried the following code in IE, but nothing happens.

You can't make strike-through (or any other text decoration) affect
input or select elements.


line-through works in select (at least options in select) in NS 7.x,
Mozilla-based browsers. One could also simply change the color from
black to silver for input type="text" and options and then make the
input and select disabled=true.

<input type="text" value="test" style="text-decoration:strike-through">
gives normal text in the textbox.

/L


CSS2 is line-through, not strike-through.

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/

Jul 20 '05 #3
DU <dr*******@hotREMOVEmail.com> writes:
line-through works in select (at least options in select) in NS 7.x,
Mozilla-based browsers.
It appears it works in IE6 too. I was checking in Opera 7, where it
doesn't.
Ofcourse, saying anything about input elements in general is dangerous,
since there is no standard that defines how they look.
CSS2 is line-through, not strike-through.


Doh. That's what I meant, ofcourse.
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #4

"Lasse Reichstein Nielsen" <lr*@hotpop.com> wrote in message
news:7k**********@hotpop.com...
DU <dr*******@hotREMOVEmail.com> writes:
line-through works in select (at least options in select) in NS 7.x,
Mozilla-based browsers.
It appears it works in IE6 too. I was checking in Opera 7, where it
doesn't.
Ofcourse, saying anything about input elements in general is dangerous,
since there is no standard that defines how they look.
CSS2 is line-through, not strike-through.


The code below following code shows line-through effect in IE 6

I have a table whose rows contain

<input type=text>, <input type=checkbox>, <span> <select> and <textarea>
elements cells.

Which is the best way to change cbonclick() so that it applies this effect
to all elements in table row ?

<table>
<tr><td><input type=checkbox onclick="cbonclick(this)"></td>
<td><input type=text value="Row 1" ></td>
<td><select><option>pine</option><option>orange</option></select></td></tr>

<tr><td><input type=checkbox onclick="cbonclick(this)"></td>
<td><input type=text value="Row 2" style="text-decoration:line-through"</td>

<td><select style="text-decoration:line-through"><option>apple</option>
<option>kiwi</option></select></td></tr>
</table>

<script>
function cbonclick(othis) {
othis.parentNode.parentNode.style.textDecoration=
'line-through';
}
</script>
Jul 20 '05 #5
y-*******@em-lyon.com (Yep) writes:
Well it seems to work as of my Opera7b version, or are my glasses
striken-through ;-) See code below (a bit strange I'll admit, but IMHO
quite adapted to the problematic, especially in regards of the CSS
complex issues involved).
When I test it in O7.20b1, only the text Hello is line-through'ed, not
the input or select elements.
/*@cc_on
What does this fancy comment do? It is something in JScript.NET, right?
Shouldn't it be /*@cc_on */ ?
Uncommenting the next line made no difference in Opera 7.20b1.
elems={td:true, input:true, select:true};


/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #6
Yep
Lasse Reichstein Nielsen <lr*@hotpop.com> wrote in message news:<7k**********@hotpop.com>...
y-*******@em-lyon.com (Yep) writes:
When I test it in O7.20b1, only the text Hello is line-through'ed, not
the input or select elements.


Interesting. The version I've been testing on is
Version 7.0
Build 2349
Platform Win32
System Windows 98
and it strikes the INPUT and SELECT elements correctly. If you add
inline style to the form controls, it even strikes twice :-)
/*@cc_on

What does this fancy comment do? It is something in JScript.NET, right?


Well I don't know for JScript.Net; in (good old) JScript that's
conditional compilation; the point actually is that browser detection
was
(IMHO) required here, given the CSS complex rules and UAs different
behaviors I'd come across (your findings with latest O7 may change the
approach, though).
Regards,
Yep.
Jul 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Garry | last post by:
Hi, I am new to python, hope someone can help me here: I have a MS Access exported .txt file which is tab delimited in total 20 columns, now I need to add another column of zero at the 4th column...
1
by: Geoff Biggs | last post by:
Evening all, I'm trying to add a new built-in number data type to Python with its own syntax, so I'm working directly with the interpreter rather than creating my own extension module (side...
10
by: David | last post by:
Can anyone give me a quick code snippet (that is standards-based) for adding OPTION tags to a SELECT dynamically. I have no problem doing it in IE but I am kind of new to the whole standards world...
11
by: Steven D'Aprano | last post by:
Suppose I create a class with some methods: py> class C: .... def spam(self, x): .... print "spam " * x .... def ham(self, x): .... print "ham * %s" % x .......
3
by: AMD Desktop | last post by:
Hi, I need to add a header to a datagrid. This is the code I am trying to use: Dim dgStaffingReport As New DataGrid Dim dgitem As New DataGridItem(0, 0, ListItemType.Header) Dim mycell...
2
by: Anna | last post by:
I added a small Web.Config file to the root of my website so that I could view errors on a machine other than the server: <configuration> <system.web> <customErrors mode="Off" /> </system.web>...
1
by: Brian Conklin | last post by:
Hello Eneryone, I am having a problem. I have written a little app that will take a text "pipe" delimited file and place all of the values in to an Excel spreadsheet. It works great on any of my...
6
by: John Salerno | last post by:
Ok, this might look familiar. I'd like to use regular expressions to change this line: self.source += '<p>' + paragraph + '</p>\n\n' to read: self.source += '<p>%s</p>\n\n' % paragraph ...
8
by: Jason | last post by:
Hello, I am trying to utilitze the AJAX Control toolkit in my asp.net project. I have added a reference to AjaxControlToolkit.dll, and in my page, added these lines of code: ...
5
by: yuleball | last post by:
I am designing an editor program using rich text box in vb 6.0. I want to add a special box for entering verse or poems so that when I click a button, this box is placed at current position of cursor...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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.