Click to See Complete Forum and Search --> : popup window...


xataku_nakusute
07-24-2003, 07:24 PM
for some odd reason, when i modify my script by changing output = self; to output = window.open(), the function opens up 2 windows instead of just one....

the code is included:

<script>

title = new Object();
desc = new Object();
descript = new Object();
links= new Object();
matched= new Object();
keywords= new Object();
found= new Object();
var temp=0;
title[0]=7
keywords[0]=0
found[0]=0

title[1]="home main index"
descript[1]="Official xio HomePage"
desc[1]="xio web was made primarily for the distribution of knowledge thr..."
links[1]="http://www.angelfire.com/yt3/eratech/index.html"
matched[1]=0

title[2]="search query find help sitemap map site where how"
descript[2]="xio Search"
desc[2]="xio web was made primarily for the distribution of knowledge thr..."
links[2]="http://www.angelfire.com/yt3/eratech/query.html"
matched[2]=0

title[3]="forum help forums dhtml html cgi perl asp php javascript java script scripts programmer hire client faq comment comments question questions"
descript[3]="xio forums"
desc[3]="xio web was made primarily for the distribution of knowledge thr..."
links[3]="http://xio.proboards22.com/"
matched[3]=0

title[4]="event handler onClick onLoad onMouseover onMouseout onUnload"
descript[4]="Understanding Event Handlers in JavaScript"
desc[4]="xio web was made primarily for the distribution of knowledge thr..."
links[4]="http://www.javascriptkit.com/event.htm"
matched[4]=0


title[5]="object model tree accessing forms "
descript[5]="Accessing and Validating Forms Using JavaScript (Part 1 of 2)"
desc[5]="xio web was made primarily for the distribution of knowledge thr..."
links[5]="http://www.javascriptkit.com/form1.htm"
matched[5]=0

title[6]="form validation onBlur onSubmit"
descript[6]="Accessing and Validating Forms Using JavaScript (Part 2 of 2)"
desc[6]="xio web was made primarily for the distribution of knowledge thr..."
links[6]="http://www.javascriptkit.com/form2.htm"
matched[6]=0

title[7]="date object write html setTimeout function"
descript[7]="Creating Time Dependent Scripts using JavaScript (Part 1 of 2)"
desc[7]="xio web was made primarily for the distribution of knowledge thr..."
links[7]="http://www.javascriptkit.com/time1.htm"
matched[7]=0

function search(){
var skeyword=document.searchengine.keywords.value.toLowerCase();
var check=1;
var pos=0;
var i=0;
var j=0;
var itemp=0;
var config='';

while (true)
{
if (skeyword.indexOf("+") == -1 )
{
keywords[check]=skeyword;
break;
}
pos=skeyword.indexOf("+");
if (skeyword !="+")
{
keywords[check]=skeyword.substring(0,pos);
check++;
}
else
{
check--;
break;
}
skeyword=skeyword.substring(pos+1, skeyword.length);
if (skeyword.length ==0)
{
check--;
break;
}

}

keywords[0]=check;


for ( i=1; i<=keywords[0];i++)
{
for (j=1;j<=title[0];j++)
{
if (title[j].toLowerCase().indexOf(keywords[i]) > -1 )
{
matched[j]++;
}
}
}


for (i=1;i<=title[0];i++)
{
if (matched[i] > 0 )
{
found[0]++;
// increment the found
found[found[0]]=i;

}
}



for (i=1;i<=found[0]-1;i++)
{
for(j=i+1;j<=found[0];j++)
{
if ( matched[found[i]]< matched[found[j]] )
{
temp= found[j];
found[j]=found[i];
found[i]=temp;
}
}
}



output = window.open();
output.document.write('<html>');
output.document.write('<head>');
output.document.write('<script>');
output.document.write('window.onerror=new Function("return true")');
output.document.write('<\/script>');
output.document.write('<title> Query Results </title>');
output.document.write('<style>');
output.document.write('a:');
output.document.write('{');
output.document.write('cursor: default;');
output.document.write('color: #696969;');
output.document.write('text-decoration: underline;');
output.document.write('filter: alpha(Opacity=67);');
output.document.write('}');
output.document.write('a:visited');
output.document.write('{');
output.document.write('cursor: default;');
output.document.write('color: #696969;');
output.document.write('text-decoration: underline;');
output.document.write('filter: alpha(Opacity=67);');
output.document.write('}');
output.document.write('a:hover');
output.document.write('{');
output.document.write('cursor: default;');
output.document.write('color: #c0c0c0;');
output.document.write('text-decoration: none;');
output.document.write('filter: alpha(Opacity=67);');
output.document.write('}');
output.document.write('body');
output.document.write('{');
output.document.write('scrollbar-face-color: #ffffff;');
output.document.write('scrollbar-arrow-color: #404060;');
output.document.write('scrollbar-highlight-color: #404060;');
output.document.write('scrollbar-3dhighlight-color: #ffffff;');
output.document.write('scrollbar-darkshadow-color: #ffffff;');
output.document.write('scrollbar-shadow-color: #404060;');
output.document.write('scrollbar-track-color: #ffffff;');
output.document.write('font-family: arial, tahoma;');
output.document.write('font-size: 9pt;');
output.document.write('color: #404060;');
output.document.write('}');
output.document.write('table');
output.document.write('{');
output.document.write('background: #ffffff;');
output.document.write('border-style: solid;');
output.document.write('border-width: 1px;');
output.document.write('border-color: #404060;');
output.document.write('width: 100%;');
output.document.write('height: auto;');
output.document.write('filter: alpha(Opacity=100);');
output.document.write('}');
output.document.write('td');
output.document.write('{');
output.document.write('background: #ffffff;');
output.document.write('border-style: solid;');
output.document.write('border-width: 1px;');
output.document.write('border-color: #404060;');
output.document.write('height: auto;');
output.document.write('filter: alpha(Opacity=100);');
output.document.write('font-family: arial, tahoma;');
output.document.write('font-size: 9pt;');
output.document.write('color: #404060;');
output.document.write('}');
output.document.write('td.1');
output.document.write('{');
output.document.write('background: #404060;');
output.document.write('border-style: solid;');
output.document.write('border-width: 1px;');
output.document.write('border-color: #000000;');
output.document.write('width: 22px;');
output.document.write('text-align: center');
output.document.write('height: auto;');
output.document.write('filter: alpha(Opacity=100);');
output.document.write('font-family: arial, tahoma;');
output.document.write('font-size: 9pt;');
output.document.write('color: #ffffff;');
output.document.write('}');
output.document.write('</style>');
output.document.write('</style>');
output.document.write('</head>');
output.document.write('<BODY>');
output.document.write('<center> <h1 style="color: #404060"> Search Results </h1></center>');
output.document.write('<hr>');
output.document.write(' The Keyword(s) you searched :&nbsp;: '.big() )
for (i=1; i<=keywords[0]; i++)
{
output.document.write( keywords[i].bold() +" ");
}
output.document.write('<br>');

if (found[0]==0)
{
//alert(found[0]);
output.document.write('<hr>');
output.document.write("<b>No matches found in this search </b> <br>");
output.document.write("You may close these results and modify/delete your keywords <br>");
}
else
{

output.document.write(" <hr> <b> Your Search Results : </b> ");
output.document.write( found[0] +" Page(s) found ".italics());
output.document.write("<table border=1 width=100%>");
for (i=1; i<=found[0];i++)
{
output.document.write("<tr><td class='1' valign=middle>");
output.document.write("<center><h2>" +i +"</h2></center></td>");
output.document.write("<td valign=middle width=auto>");
itemp=found[i];
output.document.write(descript[itemp].bold() +"<br>" +
desc[itemp] +"<br>" +
links[itemp].link(links[itemp])+"<br>");
temp= (matched[itemp]/keywords[0])*100
output.document.write("Overall Rating:<div style='background:#404060; color:#c0c0c0;filter:alpha(Opacity="+temp+");width:80px;height:auto'>"+"<center>" +Math.round(temp)+"%"+" "+"Match"+"</center>"+"</div>");
matched[itemp]=0
}
found[0]=0;
output.document.write("</table>");
}
output.document.write ("");
output.document.write ("<hr>");
output.document.write ("</body></html>");
output.document.close();
}
</script>

learninghtml
08-21-2003, 10:57 PM
Hi,
Don't know if this will help have a look add this to the head of the page with the link to the popup window...

<SCRIPT LANGUAGE="JavaScript">
<!-- hide the script
function popupcontents() {

openWin = window.open("yourpopupfile.html","childWindow","top=320,left=250,width=200,height=160, menubar=no, toolbar=no, resizable=no, location=no");

openWin.focus();
}
// -->
</SCRIPT>

Then create the link to the popup browser window using this...

<a href="javascript:popupcontents()">My Link To Popup</a>

Hope that helps...

sowjsree
08-02-2010, 10:46 AM
hi friends,

recently i created one blog, that is www.natureatworld.blogspot.com, in this blog i want insert tme popup message. My main plan is visitor know exact timing for every hour.

ex:

popup message "do u know it is 6'o clock"

after one hour "do u know it is 7'o clock"

so, how to create script.

plz help me and write script above example.