displaytext

displaytext - document.write("<br...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 <html > <head> <title>Untitled Page</title> <script language="javascript" type="text/javascript"> var word var Hits var size var avglookup=0 function ClickBtn() { //alert("Hello") size=prompt("Please enter your array size?") word = new Array(size) Hits=new Array(size) for(i=0 i<size { var variable=prompt("Please enter your array Element. .","0") word[i]=variable Hits[i]=0 } var temp for (i = (size - 1) i >= 0 { for (j = 1 j <= i { if (word[j-1] > word[j]) { temp = word[j-1] word[j-1] = word[j] word[j] = temp } } } } function OnFindText() { var SearchText=document.getElementById('Text1').value var found=0 for(i=0 i<size { if(word[i]==SearchText) { var loc=i+1 Hits[i]=Hits[i]+1 found=1 alert(word[i]+' was found at location '+loc+" Hits happend "+Hits[i]) } } if(found==0) { alert("Given Text was not found") }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Sheet1 Page 2 } function DisplayData() { document.writeln(div1.innerHTML)
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: document.write(&quot;&lt;br /&gt;&quot;) document.writeln(&quot;Loc Word Hits &quot;) document.write(&quot;&lt;br /&gt;&quot;) for(i=0 i&lt;size { avglookup=avglookup+Hits[i] document.writeln(i +&quot;&lt;--&gt;&quot;+word[i]+&quot;&lt;--&gt;&quot;+Hits[i]) document.write(&quot;&lt;br /&gt;&quot;) } alert(&quot; Average Lookup of word--&gt;&quot;+(avglookup/size)) } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id=&quot;form1&quot; runat=&quot;server&quot;&gt; &lt;div id=&quot;div1&quot;&gt; &lt;input id=&quot;Click&quot; type=&quot;button&quot; value=&quot;Click here to create Array&quot; onclick=&quot;ClickBtn()&quot;/&gt; &lt;br /&gt; &lt;br /&gt; &lt;input id=&quot;Text1&quot; type=&quot;text&quot; value=&quot;Search&quot;/&gt; &lt;input id=&quot;Button1&quot; type=&quot;button&quot; value=&quot;Find&quot; onclick=&quot;OnFindText()&quot;/&gt; &lt;br /&gt; &lt;br /&gt; &lt;input id=&quot;Display&quot; type=&quot;button&quot; value=&quot;Display&quot; onclick=&quot;DisplayData()&quot; /&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; Sheet1 Page 3 i++) i--) j++) i++) Sheet1 Page 4 i++)...
View Full Document

This note was uploaded on 03/19/2008 for the course COMP 110 taught by Professor Stotts during the Spring '08 term at UNC.

Page1 / 4

displaytext - document.write(&amp;amp;quot;&amp;amp;lt;br...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online