Forum Moderators: open

Message Too Old, No Replies

Get Element by name problem

         

andrewsmd

1:11 pm on Apr 9, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What is wrong with this, it works when I use get element by id but not when I use get element by name.

Here is my JS
function show(divID){

var tDiv = document.getElementByName(divID);
tDiv.style.display="block";
}//show

function hide(divID){

var tDiv = document.getElementByName(divID);
tDiv.style.display="none";
}//show

Here is my html

<div id = "newDiv" name = "div53" class = "hiddenDiv" style="display: none;">
<input type = "submit" name = "newSubmit" value = "submit" onclick="hide('div53')">
</div>

And here is my CSS
.newDiv{
background-image: url("images/br_paper.jpg");
position: absolute;
top: 9em;
left: 30%;
height: 30em;
width: 30em;
border: grey groove 3px;
}

Basically I want that div to display over the rest of my page when you click the link. Then, when you submit the form, it is hidden again. Thanks,

andrewsmd

1:17 pm on Apr 9, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nevermind I got it.

whoisgregg

9:35 pm on Apr 9, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Glad you got it sorted, andrewsmd. :)

Could you perhaps post the solution for anyone else experiencing a similar problem in the future?