Hi,
At the moment I have a button which shows/hides a table. However I want to show/hide the table using a link because it looks neater on the page.
What I want to do is this, but am not suceeding:
The link will have 2 states - SHOW and HIDE.
When I click the link I want to call a function which determines the value of the link i.e Show or Hide.
If the value = Show, call function which displays the table.
If the value = Hide, call function which hides the table.
I am not able to retrieve the value of the link. I am getting an error saying it is null or not an object. Is a link an object?
(My form is called form1)
Here is my link:
<a name="linkName" id="linkName" href="#" onClick="alertValueNow();">Show</a>
Here is my JavaScript function:
function alertValueNow()
{
var name = document.form1.linkName.value;
alert("Hello " + name)
}
The error is telling me that document.form1.linkName.value is null or not an object.
Is it possible to pull the 'Show' value out from the link - or else how do I determine which state (show or hide) the link is in?
Thank you
At the moment I have a button which shows/hides a table. However I want to show/hide the table using a link because it looks neater on the page.
What I want to do is this, but am not suceeding:
The link will have 2 states - SHOW and HIDE.
When I click the link I want to call a function which determines the value of the link i.e Show or Hide.
If the value = Show, call function which displays the table.
If the value = Hide, call function which hides the table.
I am not able to retrieve the value of the link. I am getting an error saying it is null or not an object. Is a link an object?
(My form is called form1)
Here is my link:
<a name="linkName" id="linkName" href="#" onClick="alertValueNow();">Show</a>
Here is my JavaScript function:
function alertValueNow()
{
var name = document.form1.linkName.value;
alert("Hello " + name)
}
The error is telling me that document.form1.linkName.value is null or not an object.
Is it possible to pull the 'Show' value out from the link - or else how do I determine which state (show or hide) the link is in?
Thank you