Click to See Complete Forum and Search --> : Changing the text in a cell...
cusimar9
04-28-2005, 12:43 PM
Is there any way of changing the text in a cell?
I currently create a layer and then use one of Dreamweaver's functions to change the text in the layer to achieve the result I want
But if there's a way I can just change the text of a cell using Javascript that'd be better I think
tantone
04-28-2005, 01:12 PM
Use CSS for that. Javascript is way overkill.
Give cell (or TD) a class. Then set the text properties for that class in your CSS document. Off you go. See the tutorials linked in previous CSS posts for help.
Keep in mind that some really ardent wackos disabled Javascript when browsing, so sites laden with it will just simply look like hell and will essentially be un-browsable. Keeping Javascript use to a minimum is ideal.
cusimar9
04-28-2005, 01:18 PM
Well what I have is a CSS menu, where as the user hover's over a menuitem, a description will appear on one side of the cell.
How do I do that using CSS? I currently use the onmouseover event to call a javascript function...
tantone
04-28-2005, 01:23 PM
CSS is pretty powerful, but releasing that power can prove tricky and you have to be pretty crafty on some of it. Do you have a page I can look at to see the code?
cusimar9
04-28-2005, 02:11 PM
I'm not at work at the moment and the site isn't live
I've just nicked this off another website... this would work ok wouldn't it?
<tr><td><div valign="top" ID="desc"></td></tr>
<tr onMouseOver="document.getElementById('desc').innerHTML ='My Description'"><td>Test</td></tr>
CompGeek01
04-29-2005, 01:16 AM
This is a situation where I happen to disagree with Tantone on the use of Javascript. Go for it if it works. I'm getting tired of people who don't surf with JS enabled. They can deal with it. As of now you could do it with CSS, but it wouldn't really work for IE users. You can't have both. I think what you're doing is fine. Maybe one day when IE fully supports fully CSS rollovers then it'll be OK to write it all in CSS.
cusimar9
04-29-2005, 04:49 AM
To be honest it does annoy me that I have to write a webpage that works for everyone :mad:
Already have to cater for 800x600 and I know i'd slap someone who was viewing my sites at that res :D
I'm unfortunately using Javascript all over the place, as I'm a beginner and I don't know how else to do some of the things I'm doing.
CompGeek01
04-29-2005, 10:49 AM
If you want to learn CSS in all it's useful glory, check out the links provided in the Sticky at the top of the forum. Then check out places such as the ZenGarden (http://www.csszengarden.com), which truly shows off the CSS potential.
tantone
04-29-2005, 11:56 AM
I agree with compgeek on the ppl that choose to browse without JS. I'm not going to cater to them. Probably should have worded it a bit differently though.
Anyway, the main recommendation for using CSS for this is that CSS is faster to load. I pretty much feel the same way about Javascript as I do about Flash: a little bit can go a long way, and too much makes the browser go away.
As for catering to 800x600, well, there are a few things about that. 1) if you're selling something, all $ is good $, regardless of the screen res of the buyer, so going with the lower common denominator is the best idea, 2) it's a very good size for clean, neat, and well-presented layouts, 3) it gives you a bit of wiggle room for outside-of-the-box graphics or design ideas.
ScaryBinary
04-29-2005, 08:57 PM
Maybe I'm missing something here....but how could cusimar9 actually change the content of his HTML using CSS? He could show and hide divisions or spans with static text in them I guess, but if he actually wanted to dynamically change the textual content of his document, he'd have to use some sort of scripting, right? CSS is just layout. :confused:
cusimar9
05-03-2005, 05:23 AM
Sorry, yes, in this case the content of the cell changes between a handful of hard-coded choices. Therefore it can be done with CSS. For actual dynamic text I would have to use Javascript or a scripting language.
SysOpt.com
Copyright Internet.com Inc. All Rights Reserved.