Results 1 to 1 of 1

Thread: radio button script collision

  1. #1
    Join Date
    Apr 2006
    Location
    London
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation radio button script collision

    I am using the Tab content script [ http://www.dynamicdrive.com/dynamici...tabcontent.htm ]

    inside the AJAX tab script [ http://www.dynamicdrive.com/dynamici...tent/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:
    Code:
    <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:

    Code:
    <!-- 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/dynamici...bs/ajaxtabs.js ]

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

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

    thanks,
    VatsaL
    Last edited by VatsaL; 11-23-2006 at 11:15 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •