PDA

View Full Version : two scripts interfering with each other



ajfmrf
05-28-2011, 05:47 AM
1) Script Title: SAG Content Scroller v1.3

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex2/sagscroller.htm

3) Describe problem: I used the script above here-(no search.js here)
http://www.web-user.net/sag/testsag2.htmlAnd it works fine.

When I add a script to it for another part of my web page it stops working.I know it is the search.js script messing things up but I don't know why.

Here is the page with the search.js on it.
http://www.web-user.net/sag/testsag.html

this is the search.js script



/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Created by: Ivan Iraola :: http://www.cybexmag.com */

function DoSearch() {
var Flag = 0;

if (document.ToolBox.SearchOption[0].checked==true) {
var Flag = 1;
var Engine = document.ToolBox.SearchOption[0].value;
var Query = document.ToolBox.SearchBox.value;
var locName = "http://www.google.com/search?hl=en&q=";
if (Query == "") {
alert("Please enter a search term");
return;
}
location.href = (locName + Query)
}

if (document.ToolBox.SearchOption[1].checked==true) {
var Flag = 1;
var Engine = document.ToolBox.SearchOption[1].value;
var Query = document.ToolBox.SearchBox.value;
var locName = "http://www.bing.com/search?q=";
if (Query == "") {
alert("Please enter a search term");
return;
}
location.href = (locName + Query)
}

if (document.ToolBox.SearchOption[2].checked==true) {
var Flag = 1;
var Engine = document.ToolBox.SearchOption[2].value;
var Query = document.ToolBox.SearchBox.value;
if (Query == "") {
alert("Please enter a search term");
return;
}
var searchPage = "<HTML>";
searchPage += "\n";
searchPage += "<FRAMESET ROWS=\"50%,50%\">";
searchPage += "\n";
searchPage += "<FRAME SRC=\"http://www.google.com/search?hl=en&q=" + Query + "\">";
searchPage += "\n";
searchPage += "<FRAME SRC=\"http://search.yahoo.com/search?p=" + Query + "\">";
searchPage += "\n";
searchPage += "</FRAMESET>";
searchPage += "\n";
searchPage += "</HTML>";
document.write(searchPage);
}

if (Flag == 0) {
alert("Please select a search engine");
}
}


Thanks,Bud

jscheuer1
05-28-2011, 06:48 AM
Typo (missing closing angle brace on the second script tag):


<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title> test sag scroller </title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

<link rel="stylesheet" type="text/css" href="sagscroller.css" />
<script type="text/javascript" src="search.js"</script>
<script type="text/javascript" src="sagscroller.js">

/***********************************************
* SAG Content Scroller- � Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/

</script>

Let's zoom in. That line:


<script type="text/javascript" src="search.js"</script>

should be:


<script type="text/javascript" src="search.js"></script>

ajfmrf
05-28-2011, 06:58 AM
Good grief John, I must be as dumb as rain-lol

I stared at that,cut pasted and more but never noticed the obvious.

Thanks again my friend