Ky sajt do të funksionojë me kufizime, teksa bëjmë mirëmbajtjen e tij për të përmirësuar punën tuaj. Nëse një artikull nuk e zgjidh problemin tuaj dhe dëshironi të bëni një pyetje, kemi bashkësinë tonë të asistencës, e gatshme për t’ju ndihmuar, te @FirefoxSupport në Twitter dhe/r/firefox në Reddit.

Kërkoni te Asistenca

Shmangni karremëzime gjoja asistence. S’do t’ju kërkojmë kurrë të bëni një thirrje apo të dërgoni tekst te një numër telefoni, apo të na jepni të dhëna personale. Ju lutemi, raportoni veprimtari të dyshimtë duke përdorur mundësinë “Raportoni Abuzim”.

Mësoni Më Tepër

function is not recognise

  • 1 përgjigje
  • 1 e ka hasur këtë problem
  • 6 parje
  • Përgjigjja më e re nga the-edmeister

more options

I am using the following code:


<!-- sample3_1.html -->
<!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>
<title>Sample 3_1</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" language="Javascript" src="autocomp.js"></script>
<link rel="stylesheet" type="text/css" href="autocomp.css" />
</head>
<body>
<form action="" method="post" onload="javascript: createform();">
<div id="createtask" class="formclass"></div>
<div id="autocompletediv" class="autocomp"></div>
<div id="taskbox" class="taskboxclass"></div>
<div id="messagebox">
</div>
<b>Your Name</b><br />
'''<input id="yourname" style="width: 150px; height: 20px;" type="text" value="" 
		onkeypress="return autocomplete(this.value, event)" />'''
	<br></br>
Your Task<br />
<textarea style="height: 80px;"></textarea><br />
<input type="button" value="Submit" onclick="javascript: validateform('yourname')" />
<div align="center"><a href="javascript:closetask()">close</a></div>
</form>

</body>
</html>

In the file has the following code autocomp.js:

...

//
function autocomplete(thevalue, e)
{
 var theextrachar =  window.event ? window.event.keyCode : e.which;
 
 theObject = document.getElementById("autocompletediv");
 theObject.style.visibility = "visible";
 theObject.style.width = "152px";
 var posx = 0;
 var posy = 0;
 posx = (findPosX (document.getElementById("yourname")) + 1);
 posy = (findPosY (document.getElementById("yourname")) + 23);
 theObject.style.left = posx + "px";
 theObject.style.top = posy + "px";
//The location we are loading the page into.
 var objID = "autocompletediv";
 
//Take into account the backspace.
 if (theextrachar == 8)
	{
	 return(true);
	}

 if ( thevalue.length == 0 )
	{
	 var serverPage = "autocomp.php" + "?sstring=" + String.fromCharCode(theextrachar);
	}
 else 
	{
	 return(true);
	}
//
 var obj = document.getElementById(objID);
 xmlhttp.open("GET", serverPage, true);
 xmlhttp.onreadystatechange = function() 
	{
	 if (xmlhttp.readyState == 4 && xmlhttp.status == 200) 
		{
		 obj.innerHTML = xmlhttp.responseText;
		}
	}
 xmlhttp.send(null);
}
//

...

Running sample3_1.html and putting a character in the field Your Name Firebug displays the following error: autocomplete is not a function.

<input id="yourname" style="width: 150px; height: 20px;" type="text" value="" 
		onkeypress="return autocomplete(this.value, event)" />

What I find is strange is that in IE and Chrome work without problem.

Please what am I doing wrong?

Thank you in advance for your help!

I am using the following code: <pre><nowiki><!-- sample3_1.html --> <!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> <title>Sample 3_1</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <script type="text/javascript" language="Javascript" src="autocomp.js"></script> <link rel="stylesheet" type="text/css" href="autocomp.css" /> </head> <body> <form action="" method="post" onload="javascript: createform();"> <div id="createtask" class="formclass"></div> <div id="autocompletediv" class="autocomp"></div> <div id="taskbox" class="taskboxclass"></div> <div id="messagebox"> </div> <b>Your Name</b><br /> '''<input id="yourname" style="width: 150px; height: 20px;" type="text" value="" onkeypress="return autocomplete(this.value, event)" />''' <br></br> Your Task<br /> <textarea style="height: 80px;"></textarea><br /> <input type="button" value="Submit" onclick="javascript: validateform('yourname')" /> <div align="center"><a href="javascript:closetask()">close</a></div> </form> </body> </html></nowiki></pre> In the file has the following code autocomp.js: ... <pre><nowiki>// function autocomplete(thevalue, e) { var theextrachar = window.event ? window.event.keyCode : e.which; theObject = document.getElementById("autocompletediv"); theObject.style.visibility = "visible"; theObject.style.width = "152px"; var posx = 0; var posy = 0; posx = (findPosX (document.getElementById("yourname")) + 1); posy = (findPosY (document.getElementById("yourname")) + 23); theObject.style.left = posx + "px"; theObject.style.top = posy + "px"; //The location we are loading the page into. var objID = "autocompletediv"; //Take into account the backspace. if (theextrachar == 8) { return(true); } if ( thevalue.length == 0 ) { var serverPage = "autocomp.php" + "?sstring=" + String.fromCharCode(theextrachar); } else { return(true); } // var obj = document.getElementById(objID); xmlhttp.open("GET", serverPage, true); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { obj.innerHTML = xmlhttp.responseText; } } xmlhttp.send(null); } // </nowiki></pre> ... Running sample3_1.html and putting a character in the field Your Name Firebug displays the following error: autocomplete is not a function. <pre><nowiki><input id="yourname" style="width: 150px; height: 20px;" type="text" value="" onkeypress="return autocomplete(this.value, event)" /> </nowiki></pre> What I find is strange is that in IE and Chrome work without problem. Please what am I doing wrong? Thank you in advance for your help!

Ndryshuar nga cor-el

Krejt Përgjigjet (1)

more options

Try posting at the Web Development / Standards Evangelism forum at MozillaZine. The helpers over there are more knowledgeable about web page development issues with Firefox.
http://forums.mozillazine.org/viewforum.php?f=25
You'll need to register and login to be able to post in that forum.