View Single Post
  #1 (permalink)  
Old 10-09-06, 11:48 AM
zoliky's Avatar
zoliky zoliky is offline
Aspiring Coder
 
Join Date: Jun 2006
Posts: 537
Thanks: 0
Thanked 0 Times in 0 Posts
What this error mean ?

Hello
What mean this JavaScript error ?

Quote:
Error: ylib_getObj("fileInput" + nextHiddenIndex) has no properties
Source File: http://sendmsgu2.php?do=attach&more
Line: 22
I have the following source code:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="content-type"content="text/html; charset=iso-8859-1" />
  <title>Send Message</title>
  <script>
  function ylib_getObj(id,d)
  {
  	var i,x;  if(!d) d=document;
  	if(!(x=d[id])&&d.all) x=d.all[id];
  	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][id];
  	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=ylib_getObj(id,d.layers[i].document);
  	if(!x && document.getElementById) x=document.getElementById(id);
  	return x;
  }

  var nextHiddenIndex = 5;

  function AddFileInput()
  {
  	ylib_getObj("fileInput" + nextHiddenIndex).style.display = document.all ? "block" : "table-row";
  	nextHiddenIndex++;
  	if(nextHiddenIndex >= 10) ylib_getObj("attachMoreLink").style.display = "none";
  }

  function AttachMoreFiles()
  {
  	var theForm = document.getElementById( "attachform" );
  	theForm.action = "?do=attach&more";
  	theForm.submit();
  	
/*	document.foo.action = "?do=attach&more";
  	document.foo.submit();*/
  }

  function Attach()
  {
  	document.foo.action = "?do=attach";
  	document.foo.submit();
  }

  function Remove(msg)
  {
  	document.foo.action = "?do=attach&unattach=" + msg;
  	document.foo.submit();
  }
  </script>
  <style type="text/css">
  <!--
	.add, .remove
	{
		color: #0000FF;
		cursor: pointer;
		text-decoration: underline;
	}
	.remove
	{
		font-size: 75%;
	}
   -->
   </style>
</head>
<body>

<table cellspacing="0" border="0">
<tr>
<td width="150" valign="top" bgcolor="#FFFFFF">
<table cellspacing="0" border="0">
  <!-- Menu -->
  <tr><td width="150" bgcolor="#AEADB7"><b>Mesaje</b></td></tr>
  <tr><td width="150" bgcolor="#D0D0D9"><a href="privmsg.php?foldername=inbox">Inbox</a></td></tr>
  <tr><td width="150" bgcolor="#D0D0D9"><a href="privmsg.php?foldername=sent">Sent</a></td></tr>
  <tr><td width="150" bgcolor="#D0D0D9"><a href="privmsg.php?foldername=draft">Draft</a></td></tr>

  <tr><td width="150" bgcolor="#D0D0D9"><a href="privmsg.php?foldername=trash">Trash</a></td></tr>
  <tr><td width="150" bgcolor="#D0D0D9"><a href="sendmsgu2.php">Compose</a></td></tr>
  <!-- Menu 2 -->
  <tr><td width="150" bgcolor="#AEADB7"><b>Cont</b></td></tr>
  <tr><td bgcolor="#D0D0D9"><a href="ignore.php">Ignore users</a></td></tr>
  <tr><td bgcolor="#D0D0D9"><a href="address.php">Address book</a></td></tr>

  <tr><td bgcolor="#D0D0D9"><a href="editu.php">User Data</a></td></tr>
  <tr><td bgcolor="#D0D0D9"><a href="logout.php">Logout</a></td></tr>
</table>
</td>

<td width="10" bgcolor="#FFFFFF">
</td>

<td width="750" valign="top" bgcolor="#FFFFFF">
<form name="foo" id="attachform" action="sendmsgu2.php?do=attach" method="post" enctype="multipart/form-data">
<input type="hidden" name="msgid" value="111">
<input type="hidden" name="list" value="0">

Clic pe "Browse" pentru a selecta un fisier
<table cellpadding="4" cellspacing="0" border="0">
<tr valign="top" ><td><b>File 1:</b></td>
<td align="left">
<img src="images/clip_1.gif" border="0" alt="image">New Text Document.txt [<a href="javascript:Remove(136)">Remove</a>]
</td>
</tr>
<td><b>File 2:</b></td>
<td align="left">
<img src="images/clip_1.gif" border="0" alt="image">New Text Document.txt [<a href="javascript:Remove(137)">Remove</a>]
</td>

</tr>
<td><b>File 3:</b></td>
<td align="left">
<img src="images/clip_1.gif" border="0" alt="image">New Text Document.txt [<a href="javascript:Remove(138)">Remove</a>]
</td>
</tr>
<td><b>File 4:</b></td>
<td align="left">
<img src="images/clip_1.gif" border="0" alt="image">New Text Document.txt [<a href="javascript:Remove(139)">Remove</a>]
</td>
</tr>

<td><b>File 5:</b></td>
<td align="left">
<img src="images/clip_1.gif" border="0" alt="image">New Text Document.txt [<a href="javascript:Remove(140)">Remove</a>]
</td>
</tr>
<td><b>File 6:</b></td>
<td align="left">
<img src="images/clip_1.gif" border="0" alt="image">New Text Document.txt [<a href="javascript:Remove(141)">Remove</a>]
</td>
</tr>
  

<tr>
<td colspan="2">

<table style="margin:1em 0 1em 0">

<tr valing="top" id="fileInput6" style="display:none" >
<td><b>File 7:</b></td>
<td><input type="file" name="userFile6" size=20 onkeypress="KeyPress()"  ></td>
</tr>
<tr valing="top" id="fileInput7" style="display:none" >
<td><b>File 8:</b></td>
<td><input type="file" name="userFile7" size=20 onkeypress="KeyPress()"  ></td>
</tr>
<tr valing="top" id="fileInput8" style="display:none" >
<td><b>File 9:</b></td>

<td><input type="file" name="userFile8" size=20 onkeypress="KeyPress()"  ></td>
</tr>
<tr valing="top" id="fileInput9" style="display:none" >
<td><b>File 10:</b></td>
<td><input type="file" name="userFile9" size=20 onkeypress="KeyPress()"  ></td>
</tr>

</table>

<p id="attachMoreLink"><a href="javascript:AddFileInput()">Attach More Files</a></p>
<input type="submit" name="ataseaza" value="Ataseaza">


</form>	
</body>

</html>
I get this error whe I click on <p id="attachMoreLink"><a href="javascript:AddFileInput()">Attach More Files</a></p>

Anyone help me to explain what is the problem ?
Please!
Reply With Quote