Hello i need some help and cant get it where ever i try....
here is my html code
Code:
<div class="wts">
<select name="WhatToSearch">
<option value="videos">Videos</option>
<option value="groups">groups</option>
</select>
</div>
and heres my javascript(i have different on another which is the one that works best ill add it later but for now i use this to get help to understand why)
Code:
if(select.WhatToSearch.value == videos){
function openWindow() { shell.Run("http://www.veoh.com/search/videos/q/" + escape(form.query.value)); return false; }
}
if(select.WhatToSearch.value == groups){
function openWindow() { shell.Run("http://www.veoh.com/search/groups/q/" + escape(form.query.value)); return false; }
}
i need help to get whats wrong in these codes i guess it has to do with the if function is outside the function

but it doesnt work anyways so can someone help me write a working if function for this?
im not so good with such codes but i want to learn
edit
here is the one i have now
Code:
<!--
(c) by Micke1101
This is my veoh vista gadget
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Veoh video search</title>
<style type="text/css">
body {
margin: 0;
width: 135px;
height: 135px;
background-image: url(background.gif);
background-repeat: no-repeat;
}
.search {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 9px;
width: 100px;
height: 18px;
margin-top: 35px;
margin-left: 17px;
border: 1px solid #000000;
}
.layer {
position: absolute;
margin-top: 6px;
margin-left: 11px;
height: 30px;
width: 110px;
cursor: hand;
cursor: pointer;
background-image: url(blank.gif);
}
.wts{
margin-top: -20px;
margin-left: 30px;
}
.dropdowner{ /* Styling question */
/* Start layout CSS */
color:#FFF;
font-size:0.9em;
background: transparent;
width:430px;
margin-bottom:2px;
margin-top: 0px;
padding-left:2px;
background-repeat:no-repeat;
background-position:top right;
height:20px;
/* End layout CSS */
overflow:hidden;
cursor:pointer;
}
.dropdowner_content{ /* Parent box of slide down content */
/* Start layout CSS */
border:1px solid #317082;
background: transparent;
width:400px;
/* End layout CSS */
visibility:hidden;
height:0px;
overflow:hidden;
position:relative;
}
.dropdowner_content_content{ /* Content that is slided down */
padding:1px;
font-size:0.9em;
position:relative;
}
a{
color: white;
}
img {border: none;}
</style>
<script language="JavaScript" type="text/javascript">
var shell = new ActiveXObject('WScript.Shell');
function openWindow(form) {
if (form.WhatToSearch.options[form.WhatToSearch.selectedIndex].value=='videos'){
shell.Run("http://www.veoh.com/search/videos/q/" + escape(form.query.value)); return false;
} else {
shell.Run("http://www.veoh.com/search/groups/q/" + escape(form.query.value)); return false;
}
}
function logoClick() { shell.Run("http://www.veoh.com"); return false; }
</script>
<script type="text/javascript">
var dhtmlgoodies_slideSpeed = 10; // Higher value = faster
var dhtmlgoodies_timer = 10; // Lower value = faster
var objectIdToSlideDown = false;
var dhtmlgoodies_activeId = false;
var dhtmlgoodies_slideInProgress = false;
function showHideContent(e,inputId)
{
if(dhtmlgoodies_slideInProgress)return;
dhtmlgoodies_slideInProgress = true;
if(!inputId)inputId = this.id;
inputId = inputId + '';
var numericId = inputId.replace(/[^0-9]/g,'');
var answerDiv = document.getElementById('dhtmlgoodies_a' + numericId);
objectIdToSlideDown = false;
if(!answerDiv.style.display || answerDiv.style.display=='none'){
if(dhtmlgoodies_activeId && dhtmlgoodies_activeId!=numericId){
objectIdToSlideDown = numericId;
slideContent(dhtmlgoodies_activeId,(dhtmlgoodies_slideSpeed*-1));
}else{
answerDiv.style.display='block';
answerDiv.style.visibility = 'visible';
slideContent(numericId,dhtmlgoodies_slideSpeed);
}
}else{
slideContent(numericId,(dhtmlgoodies_slideSpeed*-1));
dhtmlgoodies_activeId = false;
}
}
function slideContent(inputId,direction)
{
var obj =document.getElementById('dhtmlgoodies_a' + inputId);
var contentObj = document.getElementById('dhtmlgoodies_ac' + inputId);
height = obj.clientHeight;
if(height==0)height = obj.offsetHeight;
height = height + direction;
rerunFunction = true;
if(height>contentObj.offsetHeight){
height = contentObj.offsetHeight;
rerunFunction = false;
}
if(height<=1){
height = 1;
rerunFunction = false;
}
obj.style.height = height + 'px';
var topPos = height - contentObj.offsetHeight;
if(topPos>0)topPos=0;
contentObj.style.top = topPos + 'px';
if(rerunFunction){
setTimeout('slideContent(' + inputId + ',' + direction + ')',dhtmlgoodies_timer);
}else{
if(height<=1){
obj.style.display='none';
if(objectIdToSlideDown && objectIdToSlideDown!=inputId){
document.getElementById('dhtmlgoodies_a' + objectIdToSlideDown).style.display='block';
document.getElementById('dhtmlgoodies_a' + objectIdToSlideDown).style.visibility='visible';
slideContent(objectIdToSlideDown,dhtmlgoodies_slideSpeed);
}else{
dhtmlgoodies_slideInProgress = false;
}
}else{
dhtmlgoodies_activeId = inputId;
dhtmlgoodies_slideInProgress = false;
}
}
}
function initShowHideDivs()
{
var divs = document.getElementsByTagName('DIV');
var divCounter = 1;
for(var no=0;no<divs.length;no++){
if(divs[no].className=='dropdowner'){
divs[no].onclick = showHideContent;
divs[no].id = 'dhtmlgoodies_q'+divCounter;
var answer = divs[no].nextSibling;
while(answer && answer.tagName!='DIV'){
answer = answer.nextSibling;
}
answer.id = 'dhtmlgoodies_a'+divCounter;
contentDiv = answer.getElementsByTagName('DIV')[0];
contentDiv.style.top = 0 - contentDiv.offsetHeight + 'px';
contentDiv.className='dropdowner_content_content';
contentDiv.id = 'dhtmlgoodies_ac' + divCounter;
answer.style.display='none';
answer.style.height='1px';
divCounter++;
}
}
}
window.onload = initShowHideDivs;
</script>
</head>
<body>
<div class="layer" onmousedown="return logoClick(this)";></div>
<form onsubmit="return openWindow(this)" action="" id="form"><input name="query" type="text" class="search" this.focus();" /></form>
<div class="wts">
<select name="WhatToSearch">
<option value="videos">Videos</option>
<option value="groups">groups</option>
</select>
</div>
<div class="dropdowner">Links</div>
<div class="dropdowner_content">
<div>
<a href="http://www.veoh.com/myprofile"><img src="images/profile.png" title="Profile"/></a>
<a href="http://forums.veoh.com/forum"><img src="images/forum.png" title="Forum"/></a>
</div>
</div>
</body>
</html>
also added it as its now
(though its a little different from how it should be its also
here as a demo)