Tu sei qui: Home / Lingua / Esercizi / Esercizi interattivi / I possessivi

I possessivi

Livello elementare (principianti). Il mio albero genealogico.

HTML icon Possessivic.htm — HTML, 19 KB (20275 bytes)

Contenuto del file

<head>
	<meta name="author" content="Created with Hot Potatoes by Half-Baked Software, registered to Alberto Cairoli.">
	<meta name="keywords" content="Hot Potatoes, Half-Baked Software, Windows, University of Victoria">
	<title>Il mio albero genealogico</title>
	<script language="javascript" type="text/javascript">

//<![CDATA[

<!--

// BrowserCheck Object

function BrowserCheck() {
	var b = navigator.appName
//HBS extension
	this.mac = (navigator.appVersion.indexOf('Mac') != -1)
	if (b=="Netscape") this.b = "ns"
	else if (b=="Microsoft Internet Explorer") this.b = "ie"
	else this.b = b
	this.version = navigator.appVersion
	this.v = parseInt(this.version)
	this.ns = (this.b=="ns" && this.v>=4)
	this.ns4 = (this.b=="ns" && this.v==4)
	this.ns5 = (this.b=="ns" && this.v==5)
	this.ie = (this.b=="ie" && this.v>=4)
	this.ie4 = (this.version.indexOf('MSIE 4')>0)
	this.ie5 = (this.version.indexOf('MSIE 5')>0)
	this.min = (this.ns||this.ie)
	this.CRAPBrowser = (this.ie && this.mac); //Cannot Resolve Addresses Properly
}

is = new BrowserCheck();

var LocFolder = GetFolder(window.location.href);
function GetFolder(LocPath){
	var i = LocPath.lastIndexOf('/');
	if (i<0){i=LocPath.lastIndexOf('\\')};
	return LocPath.substring(0,i);
}

function CombineURLs(InURL){
	var i = InURL.indexOf('../');
	var s = LocFolder;
	while (i >- 1){
		s = GetFolder(s);
		InURL = InURL.substring(3,InURL.length);
		i = InURL.indexOf('../');
	}
	return s + '/' + InURL;
}

x = new Array();
function ResolveURLs(InText,Attribute){
	x.length=0;
	var Temp = InText.toLowerCase();
	var z;
	var AttLen = Attribute.length + 2;
	var y=Temp.lastIndexOf(Attribute + '="');
	while (y>-1){
		var sLoc = y+AttLen;
		if (Temp.substring(sLoc,sLoc+5) != 'http:'){
			x[x.length]=new Array();
			x[x.length-1][0] = sLoc;
			z = Temp.indexOf('"',sLoc);
			x[x.length-1][1] = z;
			x[x.length-1][2] = Temp.substring(sLoc,z);
		}
		Temp = Temp.substring(0,y);
		y=Temp.lastIndexOf(Attribute + '="');
	}
	for (var j=x.length-1; j>-1; j--){
		InText = InText.substring(0,x[j][0]) + CombineURLs(x[j][2]) + InText.substring(x[j][1], InText.length);
	}
	return InText;
}

function ResolveAllURLs(Stuff){
	Stuff = ResolveURLs(Stuff,'href');
	Stuff = ResolveURLs(Stuff,'src');
	return Stuff;
}

var FlipChars = (is.mac && is.ns4);

var Feedback = '';
var Correct = 'Esatto! ';
var Incorrect = 'Alcune delle tue risposte sono sbagliate. Le risposte sbagliate sono state cancellate.'; 
var GiveHint = '&Egrave; stata aggiunta la successiva lettera giusta alla tua risposta.';
var CaseSensitive = false;
var YourScoreIs = 'Il tuo punteggio... ';
var Instructions = 'Completa con tutte le parole mancanti, poi premi "Controlla" per verificare l\'esattezza delle tue risposte.';
var BuiltCloze = '';
var ExerciseSubtitle = 'Esercizio da completare';
var ExerciseTitle = 'Il mio albero genealogico';
var FirstShow = true;
var ReadingURL = '';

var PreviousPage = history.length;







var NavBar='';



var TitleCode = '<tr><td align="center" valign="middle" bgcolor="#FFFFFF">';
TitleCode += '<font size="+1" face="Geneva,Arial" color="#ff0000">' + ExerciseTitle + '</font><br />';
TitleCode += '<font size="-1" face="Geneva,Arial" color="#ff0000">' + ExerciseSubtitle + '<br />';

TitleCode += '</font></td></tr>';

var WordBox = '';

var ClozeOpener = '<table border="0" width="85%" cellpadding="10">';
ClozeOpener += '<tr><td valign="top" bgcolor="#ffffff">';
ClozeOpener += '<form name="Cloze" onsubmit="return false"><font face="Geneva,Arial" color="#000000">';

var ClozeCloser = '</font></form></td></tr>';

var Buttons = '<tr><td align="center" valign="top" bgcolor="#ffffff">';
Buttons += '<form name="Buttons"><font face="Geneva,Arial" color="#000000">';
Buttons += '<input type="button" value="Controlla" onclick="parent.CheckAnswers()"></input>';



Buttons += '</font></form></td></tr></table>';

var GapCode = '<input type="text" name="[strGapName]" size="[strGapSize]" onFocus="parent.TrackFocus([strItemNum])" value="[strValue]"></input>';
var ClueButton = '';


function GoBack(){
	var BackSkip = history.length - PreviousPage;
	if (BackSkip > 0){
		history.go((BackSkip+1)*-1);
	}
	else{
		parent.history.back();
	}
}




function BuildExercise(){
	var OutString = '';
	var ClozeStuff = '';

	for (var i=0; i<I.length; i++){

//Add the text
		ClozeStuff += Text[i];

//Create and add the gap
//If it's already right, then add it in bold:
		if (State[i][4] == 1){
			ClozeStuff += '<b><span id="CorrectAns">' + Webble(State[i][5]) + '</span></b>';
		}
		
		else{
			GapLen = I[i][1][0][0].length;
			if (GapLen < 3){GapLen = 3;}
			Gap = ReplaceStuff('[strGapSize]', GapLen, GapCode);
			Gap = ReplaceStuff('[strGapName]', 'Gap' + i + '', Gap);
			Gap = ReplaceStuff('[strItemNum]', i + '', Gap);
			Gap = ReplaceStuff('[strValue]', State[i][5], Gap);
			ClozeStuff += Gap;	

//Create and add the clue button
			if (I[i][2].length > 0){
				Btn = ReplaceStuff('[strItemNum]', i + '', ClueButton);
				ClozeStuff += Btn;
			}
		}
	}

//Add the last bit
	if (Text.length > I.length){
		ClozeStuff += Text[Text.length-1];
	}



//Put the final pieces together
	OutString = ClozeOpener + ClozeStuff + ClozeCloser + Buttons;
	BuiltCloze = OutString;
}

function WriteFeedback(Feedback) {
	if (is.CRAPBrowser){Feedback=ResolveAllURLs(Feedback);}
//Build the output string
	var OutString = '';
	OutString += '<html>';
	OutString += '<body  background="Sfondo.jpg" bgcolor="#FFFFFF" text="#000000" link="#0000ff" vlink="#0000cc">';
	OutString += '<center><table border="0" cellpadding="5" cellspacing="1" width="85%">';
	OutString += NavBar;
	if (Feedback.length>0){
		OutString += '<tr><td bgcolor="#ffffff" align="center">'; 
		OutString += '<font face="Geneva,Arial" size="-1" color="#000000">';
		OutString += Feedback;
		OutString += '</font></td></tr>'
	}
	OutString += '</table></center></body></html>';
//Write it to the frame
	TopFrame.document.clear();
	TopFrame.document.open();
	TopFrame.document.write(OutString);
	TopFrame.document.close();
}

function DisplayExercise(){
//Build the output string
	var OutString = '';
	OutString += '<html>';
	OutString += '<body  background="Sfondo.jpg" bgcolor="#FFFFFF" text="#000000" link="#0000ff" vlink="#0000cc">';
	OutString += '<center><table border="0" cellpadding="5" cellspacing="1" width="85%">';
	OutString += TitleCode; 
	OutString += '<tr><td bgcolor="#ffffff" align="center">'; 
	if (WordBox.length > 0){
		OutString += WordBox;
	}
	OutString += '<font face="Geneva,Arial" size="-1">';
	OutString += BuiltCloze;
	OutString += '</font></td></tr>';
	OutString += NavBar;
	OutString += '</table></center></body></html>';

	if (is.CRAPBrowser){OutString=ResolveAllURLs(OutString);}

//Write it to the frame
	BottomFrame.document.clear();
	BottomFrame.document.open();
	BottomFrame.document.write(OutString);
	BottomFrame.document.close();
}

function ShowClue(ItemNum){
//alert(ItemNum);
	State[ItemNum][0] = 1;
	WriteFeedback(I[ItemNum][2]);
}

function SaveCurrentAnswers(){
	for (var i=0; i<I.length; i++){
		State[i][5] = GetGapValue(i);
	}
}

function RestoreCurrentAnswers(){
	for (var i=0; i<I.length; i++){
		SetGapValue(i, State[i][5]);
	}
}

var CurrentWord = 0;

function ReplaceStuff(Token, Replacement, InString){
	var i = InString.indexOf(Token);
	var FirstBit = '';
	var LastBit = '';
	while (i>-1){
		FirstBit = InString.substring(0, i);
		LastBit = InString.substring(i + Token.length, InString.length);	
		InString = FirstBit + Replacement + LastBit;
		i = InString.indexOf(Token);
	}
	return InString;
}

var LowerString='abcdefghijklmnopqrstuvwxyz%9A%9C%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF%F0%F1%F2%F3%F4%F5%F6%F8%F9%FA%FB%FC%FD%FE%FF';
var UpperString='ABCDEFGHIJKLMNOPQRSTUVWXYZ%8A%8C%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF%D0%D1%D2%D3%D4%D5%D6%D8%D9%DA%DB%DC%DD%DE%9F';

LowerString = unescape(LowerString);
UpperString = unescape(UpperString);

I = new Array();

I[0] = new Array();
I[0][1] = new Array();
I[0][1][0] = new Array();
I[0][1][0][0]='mio';
I[0][2]='';

I[1] = new Array();
I[1][1] = new Array();
I[1][1][0] = new Array();
I[1][1][0][0]='la mia';
I[1][2]='';

I[2] = new Array();
I[2][1] = new Array();
I[2][1][0] = new Array();
I[2][1][0][0]='la loro';
I[2][2]='';

I[3] = new Array();
I[3][1] = new Array();
I[3][1][0] = new Array();
I[3][1][0][0]='i miei';
I[3][2]='';

I[4] = new Array();
I[4][1] = new Array();
I[4][1][0] = new Array();
I[4][1][0][0]='Il loro';
I[4][2]='';

I[5] = new Array();
I[5][1] = new Array();
I[5][1][0] = new Array();
I[5][1][0][0]='mia';
I[5][2]='';

I[6] = new Array();
I[6][1] = new Array();
I[6][1][0] = new Array();
I[6][1][0][0]='mio';
I[6][2]='';

I[7] = new Array();
I[7][1] = new Array();
I[7][1][0] = new Array();
I[7][1][0][0]='mio';
I[7][2]='';

I[8] = new Array();
I[8][1] = new Array();
I[8][1][0] = new Array();
I[8][1][0][0]='mio';
I[8][2]='';

I[9] = new Array();
I[9][1] = new Array();
I[9][1][0] = new Array();
I[9][1][0][0]='sua';
I[9][2]='';

I[10] = new Array();
I[10][1] = new Array();
I[10][1][0] = new Array();
I[10][1][0][0]='mia';
I[10][2]='';

I[11] = new Array();
I[11][1] = new Array();
I[11][1][0] = new Array();
I[11][1][0][0]='I miei';
I[11][2]='';

I[12] = new Array();
I[12][1] = new Array();
I[12][1][0] = new Array();
I[12][1][0][0]='i miei';
I[12][2]='';

I[13] = new Array();
I[13][1] = new Array();
I[13][1][0] = new Array();
I[13][1][0][0]='mio';
I[13][2]='';

I[14] = new Array();
I[14][1] = new Array();
I[14][1][0] = new Array();
I[14][1][0][0]='i nostri';
I[14][2]='';


Text = new Array();
Text[0]='<center></center><b';
Text[0]+='r />Mi chiamo Sam, ';
Text[1]=' fratello si chiama Chris e ';
Text[2]=' sorella maggiore si chiama Sonia. <br />Sonia ha tre figli, Cass, Nao e Nat, io sono ';
Text[3]=' zia. Cass, Nat e Nao sono ';
Text[4]=' nipoti. ';
Text[5]=' padre, il marito di ';
Text[6]=' sorella Sonia, si chiama Alan ed &egrave; ';
Text[7]=' cognato. <br />Il fratello di ';
Text[8]=' padre, ';
Text[9]=' zio, si chiama Gio e ';
Text[10]=' moglie, ';
Text[11]=' zia, An. <br />';
Text[12]=' genitori sono Maria e Mario, ';
Text[13]=' nonni, invece, si chiamano San e Luigi. <br />Con ';
Text[14]=' fratello Chris vediamo spesso ';
Text[15]=' cugini Gian e Criss.<br /><br />(Da un testo di S. C., alunna di primo anno)<br />';


State = new Array();

CharList = new Array();

EscapeList = new Array();


function StartUp(){

	var i = 0;

	for (i=0; i<I.length; i++){
		for (j=0; j<I[i][1].length; j++){
			I[i][1][j][0] = unescape(I[i][1][j][0]);
		}
	}



	State.length = 0;
	for (i=0; i<I.length; i++){
		State[i] = new Array();
		State[i][0] = 0; // clue asked for or not
		State[i][1] = 0; // hints asked for, or penalties for checking a wrong answer
		State[i][2] = 0; // length of answer matched
		State[i][3] = 0; // score for this item
		State[i][4] = 0; // already answered correctly 
		State[i][5] = ''; // answer entered in text box (right or not)
	}
	BuildExercise();
	WriteFeedback(Instructions);
	DisplayExercise();





}

function Webble(InString){
	var OutString = '';
	var NextChar = '';
	var FoundCode = '';
	var j = 0;
	var i = 0;
	for (i=0; i<InString.length; i++){
		FoundCode = '';
		NextChar = InString.charAt(i);
		for (j=0; j<CharList.length; j++){
			if (NextChar == CharList[j]){
				FoundCode = EscapeList[j];
			}
		}
		if (FoundCode.length > 0){
			OutString += FoundCode;
		}
		else{
			OutString += NextChar;
		}
	}
	return OutString;
}

var MacChars = '%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F%90%91%92%93%94%95%96%97%98%99%9A';
MacChars += '%9B%9C%9D%9E%9F%A0%A1%A4%A5%A6%A7%A8%AA%AB%AC%AE%AF%B4%B6%BB%BC%BE%BF%C0%C1%C2%C4%C7%C8';
MacChars += '%C9%CA%CB%CC%CD%CE%CF%D0%D1%D2%D3%D4%D5%D6%D8%D9%DA%DB%DC%DD%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9';
MacChars += '%EA%EB%EC%ED%EE%EF%F1%F2%F3%F4%F5%F6%F7%F8%FB%FD';

var WinChars = '%C4%C5%C7%C9%D1%D6%DC%E1%E0%E2%E4%E3%E5%E7%E9%E8%EA%EB%ED%EC%EE%EF%F1%F3%F2%F4';
WinChars += '%F6%F5%FA%F9%FB%FC%86%BA%A7%95%B6%DF%AE%99%92%A8%C6%D8%A5%F0%AA%BA%E6%F8%BF%A1%AC%83%AB%BB';
WinChars += '%85%82%C0%C3%D5%8C%9C%96%97%93%94%91%92%F7%FFY/%A4%8B%9B%87%B7%82%84%89%C2%CA%C1%CB';
WinChars += '%C8%CD%CE%CF%CC%D3%D4%D2%DA%DB%D9%B9%88%98%AF%B0%94';


WinChars = unescape(WinChars);
MacChars = unescape(MacChars)

function MacStringToWin(InString){

	var OutString = '';
	for (i=0; i<InString.length; i++){
		if ( (InString.charAt(i) > '~') && (MacChars.indexOf(InString.charAt(i)) > -1) ){
			OutString += WinChars.charAt(MacChars.indexOf(InString.charAt(i)));
		}
		else {
			OutString += InString.charAt(i);
		}
	}
	return OutString;
}

function WinStringToMac(InString){

	var OutString = '';
	for (i=0; i<InString.length; i++){
		if ( (InString.charAt(i) > '~') && (WinChars.indexOf(InString.charAt(i)) > -1) ){
			OutString += MacChars.charAt(WinChars.indexOf(InString.charAt(i)));
		}
		else {
			OutString += InString.charAt(i);
		}
	}
	return OutString;
}

function TrimString(InString){
        var x = 0

        if (InString.length != 0) {
                while ((escape(InString.charAt(InString.length - 1)) == '%20') || (escape(InString.charAt(InString.length - 1)) == '%0A') || (escape(InString.charAt(InString.length - 1)) == '%0D')){
                        InString = InString.substring(0, InString.length - 1)
                }

                while ((escape(InString.charAt(0)) == '%20') || (escape(InString.charAt(0)) == '%0A') || (escape(InString.charAt(0)) == '%0D')){
                        InString = InString.substring(1, InString.length)
                }

                while (InString.indexOf('  ') != -1) {
                        x = InString.indexOf('  ')
                        InString = InString.substring(0, x) + InString.substring(x+1, InString.length)
                 }

                return InString;
        }

        else {
                return '';
        }

}

function ConvertCase(InString, Direction){

	var FromString = '';
	var ToString = '';

	if (Direction == 0){
		FromString = UpperString;
		ToString = LowerString;
	}
	else{
		FromString = LowerString;
		ToString = UpperString;
	}

	var i = 0;
	j = 0;
	var OutString = '';
	for (i=0; i<InString.length; i++){
		if (FromString.indexOf(InString.charAt(i)) > -1){
			j = FromString.indexOf(InString.charAt(i));			
			OutString += ToString.charAt(j);
		}
		else{	
			OutString += InString.charAt(i);
		}
	}
	return OutString;
}

function CheckAnswers(){

	SaveCurrentAnswers();
	var AllCorrect = 1;

//Check each answer
	for (var i = 0; i< I.length; i++){

		if (State[i][4] != 1){
//If it's right, calculate its score
			if (CheckAnswer(i, true) > -1){
				var TotalChars = GetGapValue(i).length;
				State[i][3] = (TotalChars-State[i][1])/TotalChars;
				if (State[i][0] > 0){State[i][3] = State[i][3]/2;}
				if (State[i][3]<0){State[i][3] = 0;}
				State[i][4] = 1;
			}
			else{
//Otherwise, add zero to the array and increment the hints for this item, as a penalty
				State[i][1]++;
				State[i][3] = 0;

//then set the flag
				AllCorrect = 0;
			}
		}
	}

//Calculate the total score
	var TotalScore = 0;
	for (i=0; i<State.length; i++){
		TotalScore += State[i][3];
	}
	TotalScore = Math.floor((TotalScore * 100)/I.length);

//Compile the output
	Output = '';

	if (AllCorrect == 1){
		Output = Correct + '<br />';
	}

	Output += YourScoreIs + ' ' + TotalScore + '%.<br />';
	if (AllCorrect == 0){
		Output += '<br />' + Incorrect;
	}
	BuildExercise();
	WriteFeedback(Output);



	DisplayExercise();
	RestoreCurrentAnswers();
}


function TrackFocus(BoxNumber){
	CurrentWord = BoxNumber;
}

function CheckBeginning(Guess, Answer){
	var OutString = '';
	var i = 0;
	var UpperGuess = '';
	var UpperAnswer = '';

	if (CaseSensitive == false) {
		UpperGuess = ConvertCase(Guess, 1);
		UpperAnswer = ConvertCase(Answer, 1);
	}
	else {
		UpperGuess = Guess;
		UpperAnswer = Answer;
	}

	while (UpperGuess.charAt(i) == UpperAnswer.charAt(i)) {
		OutString += Guess.charAt(i);
		i++;
	}
	OutString += Answer.charAt(i);
	return OutString;
}

function FindLongest(InArray){
	if (InArray.length < 1){return -1;}

	var Longest = 0;
	for (var i=1; i<InArray.length; i++){
		if (InArray[i].length > InArray[Longest].length){
			Longest = i;
		}
	}
	return Longest;
}

function GetGapValue(GNum){
	var RetVal = '';
	if ((GNum<0)||(GNum>=I.length)){return RetVal;}
	if (eval('BottomFrame.document.Cloze.Gap' + GNum) != null){
		RetVal = eval('BottomFrame.document.Cloze.Gap' + GNum).value;
		if (FlipChars==true){RetVal = MacStringToWin(RetVal);}
		RetVal = TrimString(RetVal);
	}
	else{
		RetVal = State[GNum][5];
	}
	return RetVal;
}

function SetGapValue(GNum, Val){
	if ((GNum<0)||(GNum>=I.length)){return;}
	if (FlipChars==true){Val = WinStringToMac(Val);}
	if (eval('BottomFrame.document.Cloze.Gap' + GNum) != null){
		eval('BottomFrame.document.Cloze.Gap' + GNum).value = Val;
	}
}

function FindCurrent() {
	var x = 0;
	FoundCurrent = -1;

//Test the current word:
//If it's state is not set to already correct, check the word.
	if (State[CurrentWord][4] != 1){
		if (CheckAnswer(CurrentWord, false) < 0){
			return CurrentWord;
		}
	}
	
	x=CurrentWord + 1;
	while (x<I.length){
		if (State[x][4] != 1){
			if (CheckAnswer(x, false) < 0){
				return x;
			}
		}
	x++;	
	}

	x = 0;
	while (x<CurrentWord){
		if (State[x][4] != 1){
			if (CheckAnswer(x, false) < 0){
				return x;
			}
		}
	x++;	
	}
	return FoundCurrent;
}

function CheckAnswer(GapNum, MarkAnswer){
	var Guess = GetGapValue(GapNum);
	var UpperGuess = '';
	var UpperAnswer = '';
	if (CaseSensitive == false){
		UpperGuess = ConvertCase(Guess, 1);
	}
	else{
		UpperGuess = Guess;
	}
	var Match = -1;
	for (var i = 0; i<I[GapNum][1].length; i++){
		if (CaseSensitive == false){
			UpperAnswer = ConvertCase(I[GapNum][1][i][0], 1);
		}
		else{
			UpperAnswer = I[GapNum][1][i][0];
		}
		if (TrimString(UpperGuess) == UpperAnswer){
			Match = i;
			if (MarkAnswer == true){
				State[GapNum][4] = 1;
			}
			State[GapNum][5] = Guess;
		}
	}
	return Match;
}

function GetHint(GapNum){
	Guess = GetGapValue(GapNum);

	if (CheckAnswer(GapNum, false) > -1){return ''}
	RightBits = new Array();
	for (var i=0; i<I[GapNum][1].length; i++){
		RightBits[i] = CheckBeginning(Guess, I[GapNum][1][i][0]);
	}
	var RightOne = FindLongest(RightBits);
	var Result = I[GapNum][1][RightOne][0].substring(0,RightBits[RightOne].length);
//Add another char if the last one is a space
	if (Result.charAt(Result.length-1) == ' '){
		Result = I[GapNum][1][RightOne][0].substring(0,RightBits[RightOne].length+1);
	}
	return Result;
}

function ShowHint(){
	var CurrGap = FindCurrent();
	if (CurrGap < 0){return;}

	var HintString = GetHint(CurrGap);

	if (HintString.length > 0){
		SetGapValue(CurrGap, HintString);
		State[CurrGap][1] = State[CurrGap][1] + 1;
	}
	WriteFeedback(GiveHint);
}




function Blank(){
	return '<html><body>&copy;Half-Baked Software. Loading...</body></html>';
}

//-->

//]]>

</script>
</head>

<!--<body>Fool those dumb ad-inserting ISPs</body>-->
<!--For full XHTML 1.0 compatibility, remove the border and framespacing attributes.
These are required for proper display in current browsers, but render the document incompatible. Then, you'll need to add the appropriate Document Type Declaration; use
the W3C XHTML 1 frameset DTD.-->
<frameset rows="15%,*" framespacing="0" border="0" onload="StartUp()">
	<frame src="javascript:parent.Blank()" frameborder="0" name="TopFrame">
	<frame src="javascript:parent.Blank()" frameborder="0" name="BottomFrame">
</frameset>
</html>