p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Javascript How-To (http://p2p.wrox.com/forumdisplay.php?f=87)
-   -   timeouthandler?? (http://p2p.wrox.com/showthread.php?t=30625)

zlotyi June 20th, 2005 06:54 AM

timeouthandler??
 
Hi all!

It is a function, that searches for a predifined word.
If it is found, generate a predifined page.
The predifined word and the predifined page is in an array called wl.
The script ends up the function both locally and on a remote server.
Problem occurs only on the remote server, only if a word found.
The problem is that the actual browser window does not respond instead of generating the predifined page.
It should fail at this block:
Code:

this.window.document.open();
this.window.document.write(html1);
this.window.document.write(wl[c]);
this.window.document.write(html3);
this.window.document.close();

I think it is syntactically correct, because it works locally.
The problem is in the array data, I think.
wl[c] is too big.
There should be a timeout.
Here is all the code i use:
Code:

//Search and mactch the query
function search01(){
wl = new Array()


wl[0]="julianna apartment:<br /><br /></td></tr><tr><td height='30' colspan='4' valign='middle' align='center'><form name='lastminutebooking_apartments_search12' action='javascript:search();'><input type='text' name='apartments12' class='quicksrchselectfields11' style='height: 25px; background-color: #FFFFFF; border-width: 3px;'>&nbsp;<input type='submit' name='search_apartment' value='search apartment!' class='quicksrchbuttons11' style='width: 150px; height: 25px; border-width: 3px;' ></form></td></tr><tr><td height='50' colspan='4' valign='middle' align='center' class='linebreak0'><a href='http://www.lastminutebooking.freeweb.hu/index.htm' target='_self' >&laquo;&nbsp;&nbsp;back&nbsp;to&nbsp;the&nbsp;lastminutebooking&nbsp;apartments</a></td></tr><tr><td colspan='1' valign='middle' align='left'><form name='lastminutebooking_apartments11' id='lastminutebooking_apartments11' ><br /><select name='apartments11' id='apartments11' onchange='javascript:search();' class='quicksrchselectfields11' ><option selected='selected' > select apartment </option><option value='fiumei' > Fiumei </option><option value='julianna' > Julianna </option><option value='saint-stephen' > Saint-Stephen </option><option value='danube 1.' > Danube 1. </option><option value='danube 2.' > Danube 2. </option><option value='danube 3.' > Danube 3. </option><option value='danube 4.' > Danube 4. </option><option value='danube 5.' > Danube 5. </option><option value='danube 6.' > Danube 6. </option><option value='danube 7.' > Danube 7. </option><option value='danube 8.' > Danube 8. </option><option value='danube 9.' > Danube 9. </option><option value='danube 10.' > Danube 10. </option><option value='danube 11.' > Danube 11. </option><option value='danube 12.' > Danube 12. </option></select></form></td><td colspan='3' valign='middle' align='left'><span style='font-size: 14px;' >14.&nbsp;&nbsp;APARTMENT&nbsp;&nbsp;&raquo;&nbsp;&nbsp;JULIANNA&nbsp;APARTMENT&nbsp;&nbsp;&raquo;&nbsp;&nbsp;</span><a href='lastminutebooking.htm' style='font-size: 14px;' >LASTMINUTEBOOKING</a></td></tr><tr><td height='100' colspan='4' valign='middle' align='center' class='pictureframe12'><a name='14'>A&nbsp;few&nbsp;steps&nbsp;from&nbsp;the&nbsp;Danube&nbsp;shore,&nbsp;at&nbsp;the&nbsp;leg&nbsp;of&nbsp;the&nbsp;monumental&nbsp;Parliament,&nbsp;a&nbsp;familiar&nbsp;apartment&nbsp;awaiting&nbsp;it\'s&nbsp;guests.<br />One&nbsp;of&nbsp;the&nbsp;rooms&nbsp;is&nbsp;this&nbsp;double&nbsp;room.<br />There&nbsp;is&nbsp;possibility&nbsp;to&nbsp;use&nbsp;the&nbsp;internet,&nbsp;computer&nbsp;programs&nbsp;and&nbsp;fax.<br />A&nbsp;lot&nbsp;of&nbsp;facility&nbsp;resorts&nbsp;are&nbsp;nearby,&nbsp;for&nbsp;example:&nbsp;<br />parking,&nbsp;restaurant,&nbsp;shopping,&nbsp;museums,&nbsp;pedestrian&nbsp;zone,&nbsp;discotheque,&nbsp;thermal&nbsp;bath,&nbsp;beach.</a></td></tr><tr><td width='236' rowspan='2' colspan='1' valign='middle' align='center' class='pictureframe12' name='app_roomid'>Julianna&nbsp;apartment<br />suite<br />4&nbsp;seats<br />address&nbsp;:&nbsp;Alkotmany&nbsp;str.&nbsp;20.<br />owner:<br />Mr.&nbsp;Zoltan&nbsp;Ludanyi<br />contact:<br /><a href='mailto:zlotyi@yahoo.com?subject=lastminutebooking' style='font-size: 13px;'>zlotyi@yahoo.com</a><br /><a href='lastminutebooking.htm' style='font-size: 13px'>lastminutebooking</a></td><td rowspan='2' colspan='1' valign='middle' align='center' class='pictureframe12'><img align='middle' width='220' height='200' border='0' src='A001/thumb/R001.jpg' /></td><td border='0' width='200' rowspan='2' colspan='1' valign='middle' align='center' class='pictureframe12'><a href='main_map_julianna.htm' target='_self'><img align='middle' border='0' src='map_julianna.jpg' /></a></td><td width='226' height='160' colspan='1' valign='middle' align='center' class='pictureframe12'><span class='pricelistheader10'>general&nbsp;pricelist</span><br /><span class='pricelistheader11'>1&nbsp;person</span><br /><span class='pricelist11'>25&nbsp;EU/apartment/night</span><br /><span class='pricelistheader11'>2&nbsp;person</span><br /><span class='pricelist11'>35&nbsp;EU/apartment/night</span><br /><span class='pricelistheader11'>3&nbsp;person</span><br /><span class='pricelist11'>45&nbsp;EU/apartment/night</span><br /><span class='pricelistheader11'>4&nbsp;person</span><br /><span class='pricelist11'>60&nbsp;EU/apartment/night</span><br /><span class='pricelistheader11'>cleaning,&nbsp;utilities,&nbsp;taxes&nbsp;included</span></td></tr><tr><td colspan='1' valign='middle' align='center' class='pictureframe12'><a href='lastminutebooking.htm'>lastminutebooking&nbsp;&nbsp;&raquo;</a></td></tr><tr><td height='50' colspan='5' valign='middle' align='center' class='pictureframe12'><span class='facilitydescription13'>satellite&nbsp;tv,&nbsp;web&nbsp;access,&nbsp;telephone,&nbsp;an&nbsp;equipped&nbsp;kitchenette&nbsp;with&nbsp;fridge,&nbsp;owen,&nbsp;separate&nbsp;bathroom&nbsp;and&nbsp;toilet,&nbsp;together&nbsp;with&nbsp;a&nbsp;key&nbsp;to&nbsp;the&nbsp;apartment.</span></td></tr><tr><td colspan='5' height='50' valign='middle' align='center' ><span style='font-size: 16px; color= #0000FF;' ><br />The&nbsp;apartment&nbsp;can&nbsp;be&nbsp;seen&nbsp;here:</span><br/>[list]<a href='http://www.lastminutebooking.freeweb.hu/A001/A001_R001_PIC.htm' target='_self' style='font-size: 16px; color= #0000FF;' >>&nbsp;&nbsp;julianna&nbsp;apartment</a></ul></td></tr><tr><td height='50' colspan='4' valign='middle' align='center' class='linebreak0'><a href='http://www.lastminutebooking.freeweb.hu/index.htm' target='_self' >&laquo;&nbsp;&nbsp;back&nbsp;to&nbsp;the&nbsp;lastminutebooking&nbsp;apartments</a></td></tr>";

wl[1]="glossary: - an alphabetical list of technical terms in some specialized field of knowledge usually published as an appendix to a text on that field";

wl[2]="keyword: - A summarizing word or phrase in a document or record that is used in sorting and searching. (2) (n.) A word or symbol that has a specific meaning in a programming-language statement. Also called reserved word. ";

wl[3]="path: - A path can be described as a file's address on your file system, describing where the file lives: An absolute path gives the complete path, starting at the root directory, or the very top of the filesystem A relative path looks for a file from the directory you are currently in down.";



html1 = "<HTML><Head><meta http-equiv='Content-Language' content='en-gb'><meta http-equiv='Content-Type' content='text/html, charset=windows-1252'><title>WWW.LASTMINUTEBOOKING.FREEWEB.HU - LASTMINUTEBOOKING APARTMENT SEARCH</title><link href='lastminutebooking.net2.css' rel='stylesheet' type='text/css' /><Script Language='Javascript1.2' SRC='js/glossary1.js' type='text/javascript'></Script></Head><Body style='background-color:#FFFFCC'><table width='905' border='0' cellspacing='1' cellpadding='1' align='center' ><tr><td colspan='4' valign='middle' align='center' class='availheader12' style='font-size: 18px;'><br /><br />";

html3="<tr><td height='40' colspan='4' valign='bottom' align='center' ><a href='#top' target='_self' style='font-size: 18px; color: #0000FF;'>::&nbsp;&nbsp;<&nbsp;&nbsp;back&nbsp;to&nbsp;the&nbsp;top&nbsp;of&nbsp;this&nbsp;page&nbsp;&nbsp;>&nbsp;&nbsp;::</a></td></tr><tr><td height='40' colspan='4' valign='middle' align='center' ><a href='http://www.lastminutebooking.freeweb.hu/index.htm' target='_self' style='font-size: 18px; color: #0000FF;'>www.lastminutebooking.freeweb.hu,&nbsp;the&nbsp;lastminutebooking&nbsp;company.&nbsp;All&nbsp;rights&nbsp;reserved.</a></td></tr><tr><td height='20' colspan='4' valign='middle' align='center'><img align='middle' src='http://freeweb.hu/counter?username=lastminutebooking&type=4'></td></tr></table></Body></HTML>";

myWord1=document.lastminutebooking_apartments.apartments_selection.value;
myWord1.toLowerCase();
flag = 0;

for(c=0; c < wl.length; c++){
                         currentWord = wl[c].split(" ");
                                   if(currentWord[0] == myWord1){
                                   this.window.document.open();
                                   this.window.document.write(html1);
                                   this.window.document.write(wl[c]);
                                   this.window.document.write(html3);
                                   this.window.document.close();

                                  // alert(" MyWord now = " + wl[c]);
                                   flag = 1;
                                                                }
                        }
                         if(flag==0)
                         {
                          alert("The access to the apartment is actually denied, please revisit the site later!");
                          }

                  }//end of fun

How can i solve it?



All times are GMT -4. The time now is 01:02 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.