Jump to content

[SOLVED] the form vanishes...


Mortekai

Recommended Posts

I think I need to clean this up a bit and do things a bit dirrerent to get the submit form to remain even after the onClick value...not sure how though :(

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
</head>

<body>




<script language="javascript" type="text/javascript">

<!--

function MakeArray( n ) {

   if( n <= 0 )
   {
      this.length = 0;
      return this;
   }

   this.length = n;

   for( var i = 1; i <= n; i++ )
   {
      this[ i ] = 0;
   }

   return this;
}

var myForm = new MakeArray( 15 );
var index = 0;
var cmmnd = 1;

function f_store( sTR ) {

   var i;
   if( index >= myForm.length )
   {
      for( i = 1; i < myForm.length; i++ )
         myForm[i-1] = myForm[i];

      index = myForm.length - 1;
   }

   myForm[ index ] = sTR;
   ++cmmnd;
   ++index;
   document.myForm.command.value="";
}

function f_print() {

   var allCmmnds, i;
   allCmmnds = "";
   
   
document.writeln("<form name='myForm'><input name='command' type='text' value=''><input type='button' value='Lägg till titel' onclick='f_store(document.myForm.command.value)'><input name='myForm' type='button' value='Visa titlar' onclick='f_print()'></form>");
document.writeln("<table border='1' width='200'");

   for( i = 0; i < index; i++ )
//     allCmmnds += myForm[i] + "\n";
document.writeln("<tr><td>" + myForm[i] +"</td></tr>");

document.writeln("</table");

//   alert( allCmmnds );
}

// -->

</script>


<form name="myForm">

   <input name="command" type="text" value="">
   <input type="button" value="Lägg till titel" onclick="f_store(document.myForm.command.value)">
   <input name="myForm" type="button" value="Visa titlar" onclick="f_print()">

</form>



</body>
</html>

 

 

and

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<script language="javascript" type="text/javascript">
var bilar = new Array();
bilar [0] = "saab";
bilar [1] = "volvo";
bilar [2] = "mercedes";
bilar [3] = "bmw";

function search(){
var searchValue = document.getElementById("searchInputForm").value;
var resultat = "Bilen finns inte";

if (bilar.length<1){
	document.writeln("arraylistan är tom");
	}

else{

	for (var counter = 0; counter <= bilar.length-1; ++counter){

		if (bilar[counter] == searchValue){
			resultat = "bilen finns!";

			}


		}//slut på for
document.writeln(resultat);

	}//slut på else	

}//slut på funktionen

</script>
</head>
<body>





<form action="" id="theForm">
<input id="searchInputForm" name="" type="text"><input id="submitButton" name="" type="submit" onClick="search(searchInputForm)">
</form>





</body>
</html>

 

Any help is most welcome!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.