...

View Full Version : javascript, changin style of span



no one
06-14-2004, 09:47 PM
Ok, hi everyone. Ive been working with javascript for a year or two now, but ive never realy written anything. I know PHP, ASP, all that fun stuff, but I always crash when it comes to JavaScript. What im trying to do, is change the style of a <span> tag i have.

<script language="javascript">
function expand(thing) {
document.getElementById(thing).innerHTML="HE";
}
</script>

i did that to see if it was accualy getting the right span tag, and it did. so then i tried:

<script language="javascript">
function expand(thing) {
document.getElementById(thing).style="display:none";
}
</script>

it didnt like that, it said member not found or something to that effect.

thanks in advancd

Beau
06-14-2004, 09:57 PM
try


function expand(thing) {
document.getElementById(thing).style.display = "none";
}

no one
06-14-2004, 10:03 PM
ah, thank you, it worked.

thanks again :)

Beau
06-14-2004, 11:21 PM
My pleasure. I wrestled with the exact same problem until someone, on this forum I think, pointed me towards my folly. Just doing my part to pay-it-forward.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum