Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

my dhtml script doesnt work for my friends, but it works for me!!

Status
Not open for further replies.

estesflyer

Programmer
Dec 19, 2000
284
US
you can see the script in action here






<html>
<head>
<title>Search Forum</title>
<script language=&quot;javascript&quot;>
<!--
function search()
{
var searchsubject=document.formsearch.searchsubject.value;
var newwin=window.open('about:blank','newwin','menubar,width=800,height=600,left=0,top=0');
var lycos=' + searchsubject;
var altavista=' + searchsubject;
var google=' + searchsubject;
newwin.document.write('<html>');
newwin.document.write('<head>');
newwin.document.write('<title>Search Page</title>');
newwin.document.write('</head>');
newwin.document.write('<frameset>');
newwin.document.write('<frameset rows=&quot;33%,33%,33%&quot;>');
newwin.document.write('<frame name=&quot;page1&quot; src=&quot;' + lycos + '&quot;>');
newwin.document.write('<frame name=&quot;page2&quot; src=&quot;' + altavista +'&quot;>');
newwin.document.write('<frame name=&quot;page3&quot; src=&quot;' + google +'&quot;>');
newwin.document.write('</frameset>');
newwin.document.write('</frameset>');
newwin.document.write(&quot;</html>&quot;);
}
//-->
</script>
</head>
<body>
<form name=&quot;formsearch&quot;>
<b>Search for:</b>
<input size=&quot;30&quot; name=&quot;searchsubject&quot; type=&quot;textbox&quot;>
<input size=&quot;55&quot; type=&quot;button&quot; value=&quot;search&quot; onClick=&quot;search()&quot;
</body>
</html>




hope all goes well!!

- Rusty
 
hi estesflyer,

i find the following errors in your codes:

1) <input size=&quot;55&quot; type=&quot;button&quot; value=&quot;search&quot; onClick=&quot;search()&quot;
should be <input size=&quot;55&quot; type=&quot;button&quot; value=&quot;search&quot; onClick=&quot;search()&quot;>

2) before </body>, you should close the form tag </form>, otherwise it won't works for Netscape

hope this helps,
Chiu Chan
cchan@gefmus.com
 
Link doesn't work, but page works fine in IE 5.5. What exactly is the problem?

Greg.
 
which links do not work? that is the problem, my friends try to do the script, and the pages dont load, but then they hit back, and do it again, and it works! its REALLY wierd!! i would really like to know wrhat is wrong w/ it
 
Dear estesflyer,
I can tell you that your site works for me - in IE 5.5, NS 6.0 and 4.5. I wonder if your friends are not waiting for all the frames in newwin to load - lycos took a while.
 
i FINALLY figured out why it wasnt working all! its coz i had it <input type=&quot;button&quot; instead of <input type=&quot;submit&quot;. people were just hitting enter, instead of clicking on the button, or hitting tab, then space bar. all it was doing when they hit enter, was refreshing, btw, how can i fix that?
 
hi estesflyer,

if that is the case, all you need to do is change this line to.. <form name=&quot;formsearch&quot; method=post onsubmit=&quot;search()&quot;>

this should work. good luck
Chiu Chan
cchan@gefmus.com
 
you could have an onsubmit handler for the form, something like <form ... onsubmit=&quot;return form_onsubmit(false);&quot;>

for the submit button have <input ... onclick=&quot;form_onsubmit(true);&quot;>

then have the handler to be:
function form_onsubmit(blnsubmit) {
if (!blnsubmit) return false;
}

that way, if the form is submitted any way except by clicking the button, the form won't get submitted (because the function returns false) ray
rheindl@bju.edu

 
hey, i couldnt get it to work pepper, and frogger, well, i want it to be work if the user hits enter, spacebar, AND clicks on the button. that is it,
 
Hi estesflyer,

I test this in Netscape 4.0, 4.7 and IE 4.0, 5.0, it should all works when the user hits enter or click on the search button. One thing i don't understand is why you want to have the spacebar to submit the form? what happen if the user want to search for more than one word like &quot;Java Programming&quot; ? If you have any problem, let us know.

<html>
<head>
<title>Search Forum</title>
<script language=&quot;javascript&quot;>
<!--
function search()
{
var searchsubject=document.formsearch.searchsubject.value;
var newwin=window.open('about:blank','newwin','menubar,width=800,height=600,left=0,top=0');
var lycos=' + searchsubject;
var altavista=' + searchsubject;
var google=' + searchsubject;
newwin.document.write('<html>');
newwin.document.write('<head>');
newwin.document.write('<title>Search Page</title>');
newwin.document.write('</head>');
newwin.document.write('<frameset>');
newwin.document.write('<frameset rows=&quot;33%,33%,33%&quot;>');
newwin.document.write('<frame name=&quot;page1&quot; src=&quot;' + lycos + '&quot;>');
newwin.document.write('<frame name=&quot;page2&quot; src=&quot;' + altavista +'&quot;>');
newwin.document.write('<frame name=&quot;page3&quot; src=&quot;' + google +'&quot;>');
newwin.document.write('</frameset>');
newwin.document.write('</frameset>');
newwin.document.write(&quot;</html>&quot;);
}
//-->
</script>
</head>
<body>
<form name=&quot;formsearch&quot; method=post onsubmit=&quot;search()&quot;>
<b>Search for:</b>
<input size=&quot;30&quot; name=&quot;searchsubject&quot; type=&quot;textbox&quot;>
<input size=&quot;55&quot; type=&quot;button&quot; value=&quot;search&quot; onClick=&quot;search()&quot;>
</from>
</body>
</html>

hope this helps,
Chiu Chan
cchan@gefmus.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top