I have this jsf page that saves to the database. After saving it goes to a particular page. This page is then supposed to display the message that the changes were saved to the database. These are two different pages and go through several controllers. so what i did was use a hidden tag to retrieve a value.. here's my code..

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
<f:view>
<html>
<head>
<title>ShipServ Pages: Search Results</title>
<link rel="stylesheet" type="text/css" href="/pages/css/pages.css"/>
<script type="text/javascript" language="javascript" src="/pages/js/thatThing.js"></script>
<script type="text/javascript" language="javascript">
if(document.getElementById('a2z:saveMessage').value==true)
{
alert("Supplier Saved");
document.getElementById('a2z:saveMessage').value=false;
}
</script>

</head>
<h:form id="a2z">
<body>


<%@ include file="/selfService/header.jsp" %>
<table width="90%" border="1" cellspacing="0" cellpadding="4" align="center">
<tr>
<td colspan="2" class="titleBar">All Listings A to Z</td>
</tr>
<tr>
<td width="15%" class="adminMenu" style="vertical-align:top;"><%@ include file="adminMenu.jsp" %></td>
<td style="vertical-align:top;">

<%@ include file="adminListingsHeader.jsp" %>
<h:inputHidden id="saveMessage" value="#{addEditController.successfulSave}"/>
<h:inputHidden value="#{a2zController.currentLetter}" id="letter"/>

<table border="1" width="100%" cellpadding="0" cellspacing="0" class="navBar">
<tr>
<t:dataList value="#{adminController.a2z.alphabet}" var="letter">
<h:panelGroup rendered="#{adminController.a2z.currentLetter == letter}">
<f:verbatim><td width="3.8%" align="center"></f:verbatim>
<h:commandLink value="#{letter}" style="font-size:larger;" styleClass="pageNumberSelected" actionListener="#{AtoZController.paginate}" onclick="letterClicked('#{letter}')" immediate="true"/>
<f:verbatim></td></f:verbatim>
</h:panelGroup>
<h:panelGroup rendered="#{adminController.a2z.currentLetter != letter}">
<f:verbatim><td width="3.8%" align="center"></f:verbatim>
<h:commandLink value="#{letter}" styleClass="pageNumber" actionListener="#{AtoZController.paginate}" onclick="letterClicked('#{letter}')" immediate="true"/>
<f:verbatim></td></f:verbatim>
</h:panelGroup>
</t:dataList>
</tr>
</table>

<br>

<h:dataTable value="#{AtoZController.adminSuppliers}"
var="s"
border="0"
cellpadding="0"
cellspacing="0"
columnClasses="listColumn"
rowClasses="shaded,clear">

<h:column>
<h:commandLink styleClass="resultName" value="#{s.name}, #{s.address1}, #{s.address2}, #{s.city}, #{s.country}" action="#{adminController.editSupplier}" actionListener="#{adminController.editListedSupplier}" immediate="true"/>

<h:outputText value="<br><br>" escape="false"/>

<h:panelGrid id="table1"
columns="3"
border="1"
width="100%"
styleClass="tableRowMiddleAligned">

<h:column>
<h:outputText style="font-weight:bolder;" value="Listing Expiry Date"/>
</h:column>

<h:column>
<h:outputText style="font-weight:bolder;" value="Listing Level"/>
</h:column>

<h:column>
<h:outputText style="font-weight:bolder;" value="Directory Entry Status"/>
</h:column>

<h:column>
<h:outputText value="#{s.listingExpiryDate}"/>
<h:outputText value="&nbsp;" rendered="#{empty s.listingExpiryDate}" escape="false"/>
</h:column>

<h:column>
<h:outputText value="#{s.listingLevelName}"/>
</h:column>

<h:column>
<h:outputText value="#{s.listingStatus}"/>
</h:column>

</h:panelGrid>
<h:outputText value="<br>" escape="false"/>
<h:panelGrid id="table2"
columns="3"
border="1"
width="100%"
styleClass="tableRowMiddleAligned">

<h:column>
<h:outputText style="font-weight:bolder;" value="Telephone"/>
</h:column>

<h:column>
<h:outputText style="font-weight:bolder;" value="Fax"/>
</h:column>

<h:column>
<h:outputText style="font-weight:bolder;" value="Email"/>
</h:column>

<h:column>
<h:outputText value="#{s.phone1}"/>
<h:outputText value="&nbsp;" rendered="#{empty s.phone1}" escape="false"/>
</h:column>

<h:column>
<h:outputText value="#{s.fax}"/>
<h:outputText value="-" rendered="#{empty s.fax}" escape="false"/>
</h:column>

<h:column>
<h:outputText value="#{s.publicEmail}"/>
</h:column>

</h:panelGrid>

</h:column>
</h:dataTable>

</td>
</tr>
</table>
</body> 
</h:form>
</html>
</f:view>

problem is it generates a an error it says "document.getElementById("a2z:saveMessage") has no properties"

help needed badly!!

I'm assuming, not knowing JSF atall, that you're trying to refer to some element created by this line...

<h:inputHidden id="saveMessage" value="#{addEditController.successfulSave}"/>

and, again, not knowing JSF, I'm guessing that will resolve to:

<input type="hidden" id="saveMessage" value="some_value" />

In which case; why are you using:

document.getElementById('a2z:saveMessage')

Try using just 'saveMessage' as the Id. If that doesn't work, can you post the HTML output (View Source from a browser) instead of JSF?

<html>	<head>		<title>ShipServ Pages: Search Results</title>		<link rel="stylesheet" type="text/css" href="/pages/css/pages.css"/>		<script type="text/javascript" language="javascript" src="/pages/js/thatThing.js"></script>	<script type="text/javascript" language="javascript">	if(document.getElementById('a2z:saveMessage').value==true)		{		alert("Supplier Saved");		document.getElementById('a2z:saveMessage').value=false;		}	</script>	</head>	<form id="a2z" name="a2z" method="post" action="/pages/admin/adminManageListingsA2Z.jsf" enctype="application/x-www-form-urlencoded"><input type="hidden" name="jsf_tree_64" id="jsf_tree_64" value="H4sIAAAAAAAAAK1UzW7TQBDehqZVKaJqOXCrkEAqcLATx04b5cAhqH9KKaKlEsoh2trbxMVeL7vjEDhw484D8ASoT8ATcOPKS3DlzNpx2qyzaS3ExdJ82m++mW9mfPEblQVHOxHvGZhht0+M8MMZdomQIQt8F4MfUeOYE3IEPHYh5uQAU9wj/NEV2IpCFlFCYfvN/V9f9//8LKH5Dlrqun0/8LjE0X6nLSXMkYSZSZgTEmZRiWYbrXTdcdQKsBCA1trneIDNANOeKd/7tCef3bl6tue9Q59QqYMWu4kySMq9zgTn8PScuNAcsphnpf4PN5rfLzZ+rH7+8q2E0JAhhOZEUgaKk29ZxoujmAHaSGoZGiOty7KN13svcCi7aUUUsE8JB7QqSHB2RPjAd8kuwR7hLJd1+TLrU33WPoSBsSs/stIQU6/t07eA5ru+V8lyseS7MsKqGszSYDUNZmswR4PV2WXNT26o+TAGFsMxGcKIuqlJt6XBGjmsnLRWSaPbgJawJ30+IDTOu1nW0PKWpGDekxTMm5KCeVdS0BmXcjfwBciZC2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/OQ1ynnZQ025pvji//HKm5XaTN4CIGdXjtlKnEja/SiaEdKa2usNCBaw/eudn2hLzW6ArbV7JWBdTui4wLZOC+xSyyKAsO1t1H3VlbpWulSfLLcKAbYjEFWWNm5+Dz3pPdzLBkiSvnpehYhCO5odB6XPhgEKJ6FbnGy79dFNpus89NL1mX2x/oe+k13onaSL26u0F21VCWwNba7RnfJNUI3oYm59YaYW4eIucYaG/OwydACA1V90+JF6RFu1AvGaho2IBpJaGpOZ6ELdtXDQ0NPVsy7nZt3ux+7dxtYdK4Liw35LSn/he6r5RcDarnP3dtJfOO6Jk1DKsO6eYhfJWouT8eXDE1xq5t+JafQV3aB39elNID/lYD4D5TwpyBN0ngi8mBboPd2AXSkiUC/FxBo/7RqEfafB2vSDPNykigC14H4+QYQuxu1mPsPBLGLfsj990q+yN8MgLz+qNHPIoBbVRFrgS2FjfL/BASR8K3mSLgpPT0+sE4KJl2TvOWEAH1GX7LNiYq/9lXpV3dhxJeaaMS/2RNVHqlSJV/WLGBWNOnLypcbZ2VkuIms/HlPWOmtYsX9AFShxIsTX/myAV1Pa9AsAnOvtN5o3hB384SRUhLr5hFxN5kdKf0eazRvYD+9IJr7dacI/9qFeTUzcjwKqL6uRdjQm3lDJ3UEi4e7ADnaPJDh9oAgW2ZxsQ54H+4CnleW2ii83oDw2vgX+ToAftR4sI+76XjcN58NHuzDp/bEF3YzX8hNerihCB8+uScRvqcS4cvCsVG/rjhPX8X9cxeKc/dTcV8v04Di4nuiuE6muGVcbExro3uitYMVrQnJKApdqENjHzTuS+LNdJXpPdHUYb7EnCVNlbnvqU422PF/m7EU/5QuAAA=" /><input type="hidden" name="jsf_viewid" id="jsf_viewid" value="/admin/adminManageListingsA2Z.jsp" />	<body>							<table width="100%" border="0" cellspacing="0" cellpadding="0">		<tr>			<td class="topLogo">				<a href="http://www.shipserv.com/pages" align="left">					<img src="http://www.shipserv.com/ShipServ/Images/directory/logo_174x60.jpg" />				</a>			</td>			<td class="topAd">				      <p>				      For assistance, please contact your local ShipServ Customer Service Centre:<br />				      Americas: +1 732 738 6500<br />				      Asia Pacific: +852 2501 9222<br />				      Europe: +45 33 32 31 20<br />				      or email <a href="javascript:writeThis2('pages:::shipserv:::.com')"><script>writeThis('pages:::shipserv:::.com')</script></a>				      </p>			</td>		</tr>	</table>				<table width="90%" border="1" cellspacing="0" cellpadding="4" align="center">				<tr>					<td colspan="2"  class="titleBar">All Listings A to Z</td>				</tr>				<tr>					<td width="15%" class="adminMenu" style="vertical-align:top;"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><SCRIPT language=javascript type=text/javascript>function showItems(divId,divId2, Id)	{	var disp = "";	if(navigator.appName=="Microsoft Internet Explorer")	{	disp="block";	}	else	{	disp="table-row";	}		if(document.getElementById(divId).style.display ==disp)		{		document.getElementById(divId).style.display = 'none';		}	else		{		document.getElementById(divId).style.display =disp;		}				if(document.getElementById(divId2).style.display ==disp)		{		document.getElementById(divId2).style.display = 'none';		}	else		{		document.getElementById(divId2).style.display =disp;		}}</script>	<table width="100%" border="0" cellpaddin="2" cellspacing="0">		<tr>			<td align="left">				<a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:adminMenu:_id0';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:adminMenu:_id0">Home</a>			</td>		</tr>		<tr>			<td align="left">				<a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:adminMenu:_id1';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:adminMenu:_id1">Manage Listings</a>			</td>		</tr>		<tr>			<td align="left">				<a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:adminMenu:_id2';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:adminMenu:_id2">Manage Categories</a>			</td>		</tr>		<tr>			<td align="left">				<a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:adminMenu:_id3';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:adminMenu:_id3">Manage Brands</a>			</td>		</tr>		<tr>			<td align="left">				<a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:adminMenu:_id4';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:adminMenu:_id4">Manage Advertising</a>			</td>		</tr>		<tr>			<td align="left">				<a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:adminMenu:_id5';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:adminMenu:_id5">Generate Access Code</a>			</td>		</tr>		<tr>			<td align="left">				<a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:adminMenu:_id6';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:adminMenu:_id6">Email Campaign</a>			</td>		</tr>		<tr>			<td align="left">						<span onclick="javascript:showItems(1,2,2);" style="text-decoration:underline; cursor:pointer;">Statistics</span>			</td>		</tr>		<tr><td><table>				<tr id="1" style="display:none">			<td width="180" align="left">							<a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:adminMenu:_id8';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:adminMenu:_id8">&gt; By Search Attributes</a>			</td>		</tr><tr id="2" style="display:none"><td width="180" align="left">							<a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:adminMenu:_id9';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:adminMenu:_id9">&gt; List IP Address</a>			</td>		</tr>		</table>		</td></tr>		<tr>			<td align="left">							<a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:adminMenu:_id10';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:adminMenu:_id10">Logout</a>			</td>		</tr>								</table></td>					<td style="vertical-align:top;">													<table width="100%" border="1" cellpadding="0" cellspacing="0" class="adminMenu">		<tr>			<td width="20%" align="center"><a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:listingsHeader:_id11';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:listingsHeader:_id11">A to Z</a></td>			<td width="20%" align="center"><a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:listingsHeader:_id12';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:listingsHeader:_id12">TNID</a></td>			<td width="20%" align="center"><a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:listingsHeader:_id13';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:listingsHeader:_id13">Add New</a></td>			<td width="20%" align="center"><a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:listingsHeader:_id14';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:listingsHeader:_id14">Expiring Listings</a></td>			<td width="20%" align="center"><a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:listingsHeader:_id15';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:listingsHeader:_id15">Requested Listings</a></td>		</tr>	</table>						<input type="hidden" id="a2z:saveMessage" name="a2z:saveMessage" value="false" />

here's the HTML code.. I tried using just the saveMessage Id but it still won't work.. the a2z there is the form id..

Your <form> tags start before the <body> tag, not to mention most of the tags haven't been even terminated. The code is so cluttered that its difficult to mark down anything.

But considering that the statement 'document.getElementById()' is directly placed in the script tags in the head section, it would be executed as as when the page loads, a time when your hidden field hasn't been even rendered.

You need to encapsulate that logic in some sort of function and get that called on some event for the statement to work since it needs the element to be present which is not there when the page has just started getting loaded.

Even this small snippet will have the same problem and for the same reasons:

<html>
<head>
<script>
    alert(document.getElementById('a').value);
</script>
</head>
<body>
    <form>
        <input type="text" id="a" name="a" value="sanjay" />
    </form>
</body>
</html>

ok so i get the logic.. the thing is my web page saves to a database and i don't know how to get it to display a success message.. in this page.. the save button is in a different page.. so I was wondering if there is a way for it to pop up once it is redirected back to this page?

One way would be to do the same thing when the body has completely loaded. Try something like this:

<html>
<head>
<script>
    function doIt(id)
    {
        alert(document.getElementById(id).value);
    }
</script>
</head>
<body onload="doIt('a');">
    <form>
        <input type="text" id="a" name="a" value="sanjay" />
    </form>
</body>
</html>

I did what you suggested but its still came out with the same error..

Then it must be due to something else. Logically speaking, the error must have gone away. It must be because the document not being well formed. Have you moved the declaration of the form tag after the body tag and made sure you close them in the end? Post the new generated html.

<html>	<head>		<title>ShipServ Pages: Search Results</title>		<link rel="stylesheet" type="text/css" href="/pages/css/pages.css"/>		<script type="text/javascript" language="javascript" src="/pages/js/thatThing.js"></script>	<script type="text/javascript" language="javascript">	function doIt(){	alert(document.getElementById('saveMessage').value);	if(document.getElementById(id).value==true)		{		alert("Supplier Saved");		document.getElementById(id).value=false;		}	}	</script>	</head>		<body onload="doIt();">			<form id="a2z" name="a2z" method="post" action="/pages/admin/adminManageListingsA2Z.jsf" enctype="application/x-www-form-urlencoded"><input type="hidden" name="jsf_tree_64" id="jsf_tree_64" value="H4sIAAAAAAAAAK1UzW7TQBDehqZVKaJqOXCrkEAqcLATx04b5cAhqH9KKaKlEsoh2trbxMVeL7vjEDhw484D8ASoT8ATcOPKS3DlzNpx2qyzaS3ExdJ82m++mW9mfPEblQVHOxHvGZhht0+M8MMZdomQIQt8F4MfUeOYE3IEPHYh5uQAU9wj/NEV2IpCFlFCYfvN/V9f9//8LKH5Dlrqun0/8LjE0X6nLSXMkYSZSZgTEmZRiWYbrXTdcdQKsBCA1trneIDNANOeKd/7tCef3bl6tue9Q59QqYMWu4kySMq9zgTn8PScuNAcsphnpf4PN5rfLzZ+rH7+8q2E0JAhhOZEUgaKk29ZxoujmAHaSGoZGiOty7KN13svcCi7aUUUsE8JB7QqSHB2RPjAd8kuwR7hLJd1+TLrU33WPoSBsSs/stIQU6/t07eA5ru+V8lyseS7MsKqGszSYDUNZmswR4PV2WXNT26o+TAGFsMxGcKIuqlJt6XBGjmsnLRWSaPbgJawJ30+IDTOu1nW0PKWpGDekxTMm5KCeVdS0BmXcjfwBciZC2W6Baa5R6Uxu77nJQe3LPCAHBAh5HJOyjmAFgICML02pVw8pymyUWBALzElwQ6PYpaRNvNKmsxWLY2eZVFVck3NFbqxgCg0PAw4cSnVey6DtgwytfoMtesGailLtJ6BW/lMC9f0kZFqFVn5+qxjbkVBHNIsfeM6W8bprDQ6yaJqEYqtUGozxqxQ6pr2a5tKHqeIdEOhTPmnodjVSYqduPe42H75ntxkwKcBqWqqt61/GJ6tWGdPWaej1BVKEZfsLYUydR2aATkVTYuOat3UOuny1HR5lK6dKeM0LThK187o1yXG81B21qoXGGlywscJNeM4kvPwBs52xENAt7D1UT5+MOviTnzy/lUUAWN/Ac872CbqCAAA" /><input type="hidden" name="jsf_state_64" id="jsf_state_64" value="H4sIAAAAAAAAALVaXWwcVxW+u/6P82e7cUOanwmmSQPJ2t71Oo5NQ9Z/8Uq7Tup1AAXB5nrmenfS2ZnpzB17HcuhAdEIoUp9IEitWsEDQkgtf+0DiAckVFAlUJEoQiCeEA+Ih/4QXoC8wLn3zv7ZM/bOej2S587cvTP3fN8595xzz/iND1CbY6G+L6Ru4xUc0bCei1xbuk1kOvHS7z7/7cP2OS2MUNFECLU4z6G7iB2t5asOUxy2hQ7zFzhU1SIpQ8YaufufnluvDv33/TBqTaLOPLbzsqGQFOqQDUen1hpFvXzSQTbpYIZaqp6bSKFOduvgHGFztMHwFWypWKf8tmj+Dw6KwjcycCI6RYiifXOL6VR2MpFJTlF0ehArBVUX5zTW4UUp1abwbjsRvRm5bXNh+yrCJiwLr7EhxXvvnXj5HfxaCwolUaut3iEcdmi1lZ3LkCs09FdooKgFR++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qU422PF/m7EU/5QuAAA=" /><input type="hidden" name="jsf_viewid" id="jsf_viewid" value="/admin/adminManageListingsA2Z.jsp" />				<table width="100%" border="0" cellspacing="0" cellpadding="0">		<tr>			<td class="topLogo">				<a href="http://www.shipserv.com/pages" align="left">					<img src="http://www.shipserv.com/ShipServ/Images/directory/logo_174x60.jpg" />				</a>			</td>			<td class="topAd">				      <p>				      For assistance, please contact your local ShipServ Customer Service Centre:<br />				      Americas: +1 732 738 6500<br />				      Asia Pacific: +852 2501 9222<br />				      Europe: +45 33 32 31 20<br />				      or email <a href="javascript:writeThis2('pages:::shipserv:::.com')"><script>writeThis('pages:::shipserv:::.com')</script></a>				      </p>			</td>		</tr>	</table>				<table width="90%" border="1" cellspacing="0" cellpadding="4" align="center">				<tr>					<td colspan="2"  class="titleBar">All Listings A to Z</td>				</tr>				<tr>					<td width="15%" class="adminMenu" style="vertical-align:top;"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><SCRIPT language=javascript type=text/javascript>function showItems(divId,divId2, Id)	{	var disp = "";	if(navigator.appName=="Microsoft Internet Explorer")	{	disp="block";	}	else	{	disp="table-row";	}		if(document.getElementById(divId).style.display ==disp)		{		document.getElementById(divId).style.display = 'none';		}	else		{		document.getElementById(divId).style.display =disp;		}				if(document.getElementById(divId2).style.display ==disp)		{		document.getElementById(divId2).style.display = 'none';		}	else		{		document.getElementById(divId2).style.display =disp;		}}</script>	<table width="100%" border="0" cellpaddin="2" cellspacing="0">		<tr>			<td align="left">				<a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:adminMenu:_id0';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:adminMenu:_id0">Home</a>			</td>		</tr>		<tr>			<td align="left">				<a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:adminMenu:_id1';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:adminMenu:_id1">Manage Listings</a>			</td>		</tr>		<tr>			<td align="left">				<a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:adminMenu:_id2';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:adminMenu:_id2">Manage Categories</a>			</td>		</tr>		<tr>			<td align="left">				<a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:adminMenu:_id3';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:adminMenu:_id3">Manage Brands</a>			</td>		</tr>		<tr>			<td align="left">				<a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:adminMenu:_id4';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:adminMenu:_id4">Manage Advertising</a>			</td>		</tr>		<tr>			<td align="left">				<a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:adminMenu:_id5';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:adminMenu:_id5">Generate Access Code</a>			</td>		</tr>		<tr>			<td align="left">				<a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:adminMenu:_id6';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:adminMenu:_id6">Email Campaign</a>			</td>		</tr>		<tr>			<td align="left">						<span onclick="javascript:showItems(1,2,2);" style="text-decoration:underline; cursor:pointer;">Statistics</span>			</td>		</tr>		<tr><td><table>				<tr id="1" style="display:none">			<td width="180" align="left">							<a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:adminMenu:_id8';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:adminMenu:_id8">&gt; By Search Attributes</a>			</td>		</tr><tr id="2" style="display:none"><td width="180" align="left">							<a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:adminMenu:_id9';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:adminMenu:_id9">&gt; List IP Address</a>			</td>		</tr>		</table>		</td></tr>		<tr>			<td align="left">							<a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:adminMenu:_id10';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:adminMenu:_id10">Logout</a>			</td>		</tr>								</table></td>					<td style="vertical-align:top;">													<table width="100%" border="1" cellpadding="0" cellspacing="0" class="adminMenu">		<tr>			<td width="20%" align="center"><a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:listingsHeader:_id11';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:listingsHeader:_id11">A to Z</a></td>			<td width="20%" align="center"><a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:listingsHeader:_id12';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:listingsHeader:_id12">TNID</a></td>			<td width="20%" align="center"><a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:listingsHeader:_id13';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:listingsHeader:_id13">Add New</a></td>			<td width="20%" align="center"><a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:listingsHeader:_id14';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:listingsHeader:_id14">Expiring Listings</a></td>			<td width="20%" align="center"><a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:listingsHeader:_id15';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:listingsHeader:_id15">Requested Listings</a></td>		</tr>	</table>						<input type="hidden" id="a2z:saveMessage" name="a2z:saveMessage" value="false" />						<input type="hidden" id="a2z:letter" name="a2z:letter" value="" />												<table border="1" width="100%" cellpadding="0" cellspacing="0" class="navBar">							<tr>								<td width="3.8%" align="center"><a href="#" onclick="letterClicked('A');clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id16_0:_id19';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id16_0:_id19" style="font-size:larger;" class="pageNumberSelected">A</a></td><td width="3.8%" align="center"><a href="#" onclick="letterClicked('B');clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id16_1:_id23';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id16_1:_id23" class="pageNumber">B</a></td><td width="3.8%" align="center"><a href="#" onclick="letterClicked('C');clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id16_2:_id23';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id16_2:_id23" class="pageNumber">C</a></td><td width="3.8%" align="center"><a href="#" onclick="letterClicked('D');clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id16_3:_id23';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id16_3:_id23" class="pageNumber">D</a></td><td width="3.8%" align="center"><a href="#" onclick="letterClicked('E');clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id16_4:_id23';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id16_4:_id23" class="pageNumber">E</a></td><td width="3.8%" align="center"><a href="#" onclick="letterClicked('F');clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id16_5:_id23';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id16_5:_id23" class="pageNumber">F</a></td><td width="3.8%" align="center"><a href="#" onclick="letterClicked('G');clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id16_6:_id23';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id16_6:_id23" class="pageNumber">G</a></td><td width="3.8%" align="center"><a href="#" onclick="letterClicked('H');clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id16_7:_id23';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id16_7:_id23" class="pageNumber">H</a></td><td width="3.8%" align="center"><a href="#" onclick="letterClicked('I');clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id16_8:_id23';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id16_8:_id23" class="pageNumber">I</a></td><td width="3.8%" align="center"><a href="#" onclick="letterClicked('J');clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id16_9:_id23';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id16_9:_id23" class="pageNumber">J</a></td><td width="3.8%" align="center"><a href="#" onclick="letterClicked('K');clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id16_10:_id23';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id16_10:_id23" class="pageNumber">K</a></td><td width="3.8%" align="center"><a href="#" onclick="letterClicked('L');clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id16_11:_id23';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id16_11:_id23" class="pageNumber">L</a></td><td width="3.8%" align="center"><a href="#" onclick="letterClicked('M');clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id16_12:_id23';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id16_12:_id23" class="pageNumber">M</a></td><td width="3.8%" align="center"><a href="#" onclick="letterClicked('N');clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id16_13:_id23';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id16_13:_id23" class="pageNumber">N</a></td><td width="3.8%" align="center"><a href="#" onclick="letterClicked('O');clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id16_14:_id23';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id16_14:_id23" class="pageNumber">O</a></td><td width="3.8%" align="center"><a href="#" onclick="letterClicked('P');clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id16_15:_id23';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id16_15:_id23" class="pageNumber">P</a></td><td width="3.8%" align="center"><a href="#" onclick="letterClicked('Q');clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id16_16:_id23';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id16_16:_id23" class="pageNumber">Q</a></td><td width="3.8%" align="center"><a href="#" onclick="letterClicked('R');clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id16_17:_id23';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id16_17:_id23" class="pageNumber">R</a></td><td width="3.8%" align="center"><a href="#" onclick="letterClicked('S');clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id16_18:_id23';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id16_18:_id23" class="pageNumber">S</a></td><td width="3.8%" align="center"><a href="#" onclick="letterClicked('T');clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id16_19:_id23';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id16_19:_id23" class="pageNumber">T</a></td><td width="3.8%" align="center"><a href="#" onclick="letterClicked('U');clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id16_20:_id23';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id16_20:_id23" class="pageNumber">U</a></td><td width="3.8%" align="center"><a href="#" onclick="letterClicked('V');clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id16_21:_id23';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id16_21:_id23" class="pageNumber">V</a></td><td width="3.8%" align="center"><a href="#" onclick="letterClicked('W');clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id16_22:_id23';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id16_22:_id23" class="pageNumber">W</a></td><td width="3.8%" align="center"><a href="#" onclick="letterClicked('X');clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id16_23:_id23';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id16_23:_id23" class="pageNumber">X</a></td><td width="3.8%" align="center"><a href="#" onclick="letterClicked('Y');clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id16_24:_id23';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id16_24:_id23" class="pageNumber">Y</a></td><td width="3.8%" align="center"><a href="#" onclick="letterClicked('Z');clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id16_25:_id23';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id16_25:_id23" class="pageNumber">Z</a></td>							</tr>						</table>												<br>													<table border="0" cellpadding="0" cellspacing="0"><tbody id="a2z:_id25:tbody_element"><tr class="shaded"><td class="listColumn"><a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id25_0:_id27';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id25_0:_id27" class="resultName">Armageddon,  , , , Andorra</a><br><br><table id="a2z:_id25_0:table1" border="1" width="100%" class="tableRowMiddleAligned"><tbody><tr><td><span style="font-weight:bolder;">Listing Expiry Date</span></td><td><span style="font-weight:bolder;">Listing Level</span></td><td><span style="font-weight:bolder;">Directory Entry Status</span></td></tr><tr><td>19-MAY-2007</td><td>Free Basic</td><td>PUBLISHED</td></tr></tbody></table><br><table id="a2z:_id25_0:table2" border="1" width="100%" class="tableRowMiddleAligned"><tbody><tr><td><span style="font-weight:bolder;">Telephone</span></td><td><span style="font-weight:bolder;">Fax</span></td><td><span style="font-weight:bolder;">Email</span></td></tr><tr><td> </td><td>-</td><td>elaine@yahoo.com</td></tr></tbody></table></td></tr><tr class="clear"><td class="listColumn"><a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id25_1:_id27';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id25_1:_id27" class="resultName">Armageddon,  , , , Afghanistan</a><br><br><table id="a2z:_id25_1:table1" border="1" width="100%" class="tableRowMiddleAligned"><tbody><tr><td><span style="font-weight:bolder;">Listing Expiry Date</span></td><td><span style="font-weight:bolder;">Listing Level</span></td><td><span style="font-weight:bolder;">Directory Entry Status</span></td></tr><tr><td>02-MAY-2007</td><td>Free Basic</td><td>PUBLISHED</td></tr></tbody></table><br><table id="a2z:_id25_1:table2" border="1" width="100%" class="tableRowMiddleAligned"><tbody><tr><td><span style="font-weight:bolder;">Telephone</span></td><td><span style="font-weight:bolder;">Fax</span></td><td><span style="font-weight:bolder;">Email</span></td></tr><tr><td> </td><td>-</td><td>1@2.com</td></tr></tbody></table></td></tr><tr class="shaded"><td class="listColumn"><a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id25_2:_id27';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id25_2:_id27" class="resultName">Armi Shipping,  , , , United States</a><br><br><table id="a2z:_id25_2:table1" border="1" width="100%" class="tableRowMiddleAligned"><tbody><tr><td><span style="font-weight:bolder;">Listing Expiry Date</span></td><td><span style="font-weight:bolder;">Listing Level</span></td><td><span style="font-weight:bolder;">Directory Entry Status</span></td></tr><tr><td>25-DEC-2007</td><td>Standard</td><td>PUBLISHED</td></tr></tbody></table><br><table id="a2z:_id25_2:table2" border="1" width="100%" class="tableRowMiddleAligned"><tbody><tr><td><span style="font-weight:bolder;">Telephone</span></td><td><span style="font-weight:bolder;">Fax</span></td><td><span style="font-weight:bolder;">Email</span></td></tr><tr><td> </td><td>-</td><td>dfad@yahoo.com</td></tr></tbody></table></td></tr><tr class="clear"><td class="listColumn"><a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id25_3:_id27';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id25_3:_id27" class="resultName">Armi Shipping,  , , , United States</a><br><br><table id="a2z:_id25_3:table1" border="1" width="100%" class="tableRowMiddleAligned"><tbody><tr><td><span style="font-weight:bolder;">Listing Expiry Date</span></td><td><span style="font-weight:bolder;">Listing Level</span></td><td><span style="font-weight:bolder;">Directory Entry Status</span></td></tr><tr><td>23-JUN-2007</td><td>Premium</td><td>PUBLISHED</td></tr></tbody></table><br><table id="a2z:_id25_3:table2" border="1" width="100%" class="tableRowMiddleAligned"><tbody><tr><td><span style="font-weight:bolder;">Telephone</span></td><td><span style="font-weight:bolder;">Fax</span></td><td><span style="font-weight:bolder;">Email</span></td></tr><tr><td> </td><td>-</td><td>armi@gmail.com</td></tr></tbody></table></td></tr><tr class="shaded"><td class="listColumn"><a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id25_4:_id27';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id25_4:_id27" class="resultName">AsaNess,  , , , American Samoa</a><br><br><table id="a2z:_id25_4:table1" border="1" width="100%" class="tableRowMiddleAligned"><tbody><tr><td><span style="font-weight:bolder;">Listing Expiry Date</span></td><td><span style="font-weight:bolder;">Listing Level</span></td><td><span style="font-weight:bolder;">Directory Entry Status</span></td></tr><tr><td>&nbsp;</td><td>Premium</td><td>PUBLISHED</td></tr></tbody></table><br><table id="a2z:_id25_4:table2" border="1" width="100%" class="tableRowMiddleAligned"><tbody><tr><td><span style="font-weight:bolder;">Telephone</span></td><td><span style="font-weight:bolder;">Fax</span></td><td><span style="font-weight:bolder;">Email</span></td></tr><tr><td> </td><td>-</td><td>fsdffdsl@email.com</td></tr></tbody></table></td></tr><tr class="clear"><td class="listColumn"><a href="#" onclick="clear_a2z();document.forms['a2z'].elements['autoScroll'].value=getScrolling();document.forms['a2z'].elements['a2z:_link_hidden_'].value='a2z:_id25_5:_id27';if(document.forms['a2z'].onsubmit){if(document.forms['a2z'].onsubmit()) document.forms['a2z'].submit();}else{document.forms['a2z'].submit();}return false;" id="a2z:_id25_5:_id27" class="resultName">Automotive Supplier,  , , , Afghanistan</a><br><br><table id="a2z:_id25_5:table1" border="1" width="100%" class="tableRowMiddleAligned"><tbody><tr><td><span style="font-weight:bolder;">Listing Expiry Date</span></td><td><span style="font-weight:bolder;">Listing Level</span></td><td><span style="font-weight:bolder;">Directory Entry Status</span></td></tr><tr><td>18-AUG-2007</td><td>Premium</td><td>PUBLISHED</td></tr></tbody></table><br><table id="a2z:_id25_5:table2" border="1" width="100%" class="tableRowMiddleAligned"><tbody><tr><td><span style="font-weight:bolder;">Telephone</span></td><td><span style="font-weight:bolder;">Fax</span></td><td><span style="font-weight:bolder;">Email</span></td></tr><tr><td> </td><td>-</td><td>red@red.com</td></tr></tbody></table></td></tr></tbody></table>											</td>				</tr>			</table>			<input type="hidden" name="a2z_SUBMIT" value="1" /><input type="hidden" name="autoScroll" /><input type="hidden" name="a2z:_link_hidden_" /><script type="text/javascript"><!--function clear_a2z() {  var f = document.forms['a2z'];  f.elements['a2z:_link_hidden_'].value='';  f.target='';}clear_a2z();//--></script></form>	</body>		</html><script type="text/javascript"><!--function getScrolling() {    var x = 0; var y = 0;    if (self.pageXOffset) {        x = self.pageXOffset;        y = self.pageYOffset;    } else if (document.documentElement && document.documentElement.scrollLeft) {        x = document.documentElement.scrollLeft;        y = document.documentElement.scrollTop;    } else if (document.body) {        x = document.body.scrollLeft;        y = document.body.scrollTop;    }    return x + "," + y;}//--></script>

yeah, i moved the form tag and closed it properly..

Go back to using

document.getElementById('a2z:saveMessage')

and ignore what I said about not using the a2z:, I didn't realise that your serverside application would prefix that to the element's id.

you should avoid outputting this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

in the middle of the page... it's invalid after or inside the document's root element; it should be the first line of an html file.

I still won't whether you completely understand Javascript and its use. I see a lot of hanging useless pieces of <script> tags scattered all over the pages and even after the closing </html> tag !!!

I see a lot of problems:

1. The function definition should be something like:

<script type="text/javascript" language="javascript">
    function doIt(id)
    {
        if(document.getElementById(id).value == "true")
        {
            alert("Supplier Saved");
            document.getElementById(id).value = "false";
        }
    }
</script>

....pass to doIt the id of the hidden field whose value you want

<body onload="doIt('a2z:_link_hidden_');">

....

And stop changing the id and names of your fields, you just end up confusing us. And decide on which fields value is required for you to display the error message.

function doIt(){
alert(document.getElementById('a2z:saveMessage').value);

if(document.getElementById('a2z:saveMessage').value=true)
{
alert("Supplier Saved");
document.getElementById('a2z:saveMessage').value=false;
}
}

thanks to all your help i was able to solve the no properties error.. now i've got a new problem, even if the value is false it keeps entering the condition and I cant find out why..

function doIt(){
alert(document.getElementById('a2z:saveMessage').value);

if(document.getElementById('a2z:saveMessage').value=true)
{
alert("Supplier Saved");
document.getElementById('a2z:saveMessage').value=false;
}
}

thanks to all your help i was able to solve the no properties error.. now i've got a new problem, even if the value is false it keeps entering the condition and I cant find out why..

Do this:

function doIt()
{
    alert(document.getElementById('a2z:saveMessage').value);
    if(document.getElementById('a2z:saveMessage').value == "true")
    {
        alert("Supplier Saved");
        document.getElementById('a2z:saveMessage').value = "false";
    }
}

thanks your suggestions worked!! thank you guys really.. now I can't finally get some rest.. :)

Glad you could figure it out. Try reading some good tutorials to solidify your concepts of Javascript and you won't run into such simple problems.

This question has already been answered. Start a new discussion instead.