PDA

View Full Version : radio button script collision



VatsaL
11-23-2006, 03:56 AM
I am using the Tab content script [ http://www.dynamicdrive.com/dynamicindex17/tabcontent.htm ]

inside the AJAX tab script [ http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/index.htm ]

Everything works perfectly, exept a script I inserted into the tab content tabs, which lets you select which search engine by radio buttons.

The script lets you choose a search engine by radio buttons and gets you the results from the selected engine.

This is how it goes:

<script language="JavaScript">
<!--
current_site = "Google"

var set_def = false

function fetch() {

if (set_def == true) {

set_default = "t"

}else{

set_default = ""

}

tmp = document.uns.go.value;

stmp = "";

for (i=0 ; i <= tmp.length ; i++) {

if (tmp.charAt(i) == " ") {

stmp = stmp + "+";

} else {

stmp = stmp + tmp.charAt(i);

}

}

if (current_site == "Google") {

top.location.href = "http://www.google.com/search?hl=en&q=" + document.uns.Searcha.value

}

if (current_site == "Yahoo") {

top.location.href = "http://search.yahoo.com/search?q=" + document.uns.Searcha.value

}

if (current_site == "Wikipedia") {

top.location.href = "http://en.wikipedia.org/wiki/Special:Search?search=" + document.uns.Searcha.value

}

if (current_site == "Live Search") {

top.location.href = "http://search.live.com/results.aspx?q=" + document.uns.Searcha.value

}


return false;

}



function toggle_setdef() {

set_def = !(set_def);

}



function setsite(sitenow) {

current_site = sitenow;

}



// --></script>



..and the radio buttons and search box:


<!-- A1 -->
<center><h1>Multiple Search Engines</h1></center>
<form method="GET" name="SearchForm" onsubmit="return fetch()">
<center>
<div>
<input type="radio" name="q" id="q1" value="Google" checked onclick="setsite('Google')"><label for="q1" style="cursor: pointer; cursor: hand;">Google</label>&nbsp;&nbsp;&nbsp;
<input type="radio" name="q" id="q2" value="Yahoo" onclick="setsite('Yahoo')"><label for="q2" style="cursor: pointer; cursor: hand;">Yahoo</label>&nbsp;&nbsp;&nbsp;
<input type="radio" name="q" id="q3" value="Wikipedia" onclick="setsite('Wikipedia')"><label for="q3" style="cursor: pointer; cursor: hand;">Wikipedia</label>&nbsp;&nbsp;&nbsp;
<input type="radio" name="q" id="q4" value="Live Search" onclick="setsite('Live Search')"><label for="q4" style="cursor: pointer; cursor: hand;">Live Search</label>&nbsp;&nbsp;&nbsp;
</div></center>
<br>
<center><input type="Text" name="Search" size=53><input type="Submit" name="Submit"></center></form><hr>
<!-- -->

These radio s and the searchbox is located inside the tab script, which in turn is inside the ajax tabs. There are no error s visible, but on submitting, the page does nothing, has no effect.

I suspect it might have to do with either "ajaxtabs.js" [ http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/ajaxtabs/ajaxtabs.js ]

or "tabcontent.js" [ http://www.dynamicdrive.com/dynamicindex17/tabcontent/tabcontent.js ]

..but I can't find what the radio script is interfering with. any ideas?

thanks,
VatsaL