seotool
03-05-2009, 03:01 AM
Hello,
I have an asp.net website and my page isn't doing what it's supposed to do and I"d really like to get this fixed:
+this.options[this.selectedIndex].value is supposed to slot into a url the name of the database (mysql) which is selected from the drop down box as soon as the user makes the selection.
There are two functions becuase the database name can be input into a textbox if my site is unable to connect to the database on their server.
+this.options[this.selectedIndex].text+ used to be .value instead of .text. I read that .value just returns the number of the index, and to get the actual name of the database, use .text. Am I correct? I doesn't work. The 2 functions and the output which I've taken from the page source code are below:
function loadFrm(){
if (this.options[this.selectedIndex].text!=""){
setMsg('create', 'Saving MySQL database details...')
document.getElementById('hdnFrm').style.display='none';
url="<%=hdnPath.value%>/admin/gen.php?host=<%=tbServer.text%>&uid=<%=tbUserName.text%>&pwd=<%=tbPasswrod.text%>&db="+this.options[this.selectedIndex].text+"&url=<%=hdnLinkURL.value%>&title=<%=hdnLinkTitle.value%>&desc=<%=hdnLinkDesc.value%>";
//alert(url);
document.getElementById('hdnFrm').src=url;
}
else{
document.getElementById('hdnFrm').style.display='none';
}
//document.getElementById('myframe').src='http://'+this.options[this.selectedindex].text;
return false;
}//end function
function loadFrm2(){
if (this.value!=""){
setMsg('create', 'Saving MySQL database details...')
document.getElementById('hdnFrm').style.display='none';
url="<%=hdnPath.Value%>/admin/gen.php?host=<%=tbServer.text%>&uid=<%=tbUserName.text%>&pwd=<%=tbPasswrod.text%>&db="+this.value+"&url=<%=hdnLinkURL.value%>&title=<%=hdnLinkTitle.value%>&desc=<%=hdnLinkDesc.value%>";
//alert('<%=lstAdvanceSites.SelectedItem.Text%>');
document.getElementById('hdnFrm').src=url;
}
else{
document.getElementById('hdnFrm').style.display='none';
}
//document.getElementById('myframe').src='http://'+this.options[this.selectedindex].text;
return false;
}//end function
</script>
Output:
<script type="text/javascript">
var firstTime=1
var url
function setMsg(id, txt){
if(id && id=='create')
firstTime=0;
if (!firstTime)
document.getElementById('ctl00_PageContents_lblMsg').innerHTML=txt;
}//end function
//
function loadFrm(){
if (document.getElementById('hdnFrm').style.display='none';
url="http://www.mortgage-pros.com/links/admin/gen.php?host=mortgage-pros.com&uid=mortpros_sking&pwd=pianos1234&db="+this.options[this.selectedIndex].text+"&url=http://www.mortgage-pros.com&title=California Mortgages&desc=Pacific West Capital is a full service California mortgage broker approved with over 100 lenders and funding in 50 states for residential and commercial mortgages. Purchase and refinance mortgages are available with low rates, low fees and top notch processing.";
!=""){
setMsg('create', 'Saving MySQL database details...')
document.getElementById('hdnFrm').style.display='none';
url="http://www.mortgage-pros.com/links/admin/gen.php?host=mortgage-pros.com&uid=mortpros_sking&pwd=pianos4&db="+this.options[this.selectedIndex].text+"&url=http://www.mortgage-pros.com&title=California Mortgages&desc=Pacific West Capital is a full service California mortgage broker approved with over 100 lenders and funding in 50 states for residential and commercial mortgages. Purchase and refinance mortgages are available with low rates, low fees and top notch processing.";
//alert(url);
document.getElementById('hdnFrm').src=url;
}
else{
document.getElementById('hdnFrm').style.display='none';
}
//document.getElementById('myframe').src='http://'+this.options[this.selectedindex].text;
return false;
}//end function
function loadFrm2(){
if (this.value!=""){
setMsg('create', 'Saving MySQL database details...')
document.getElementById('hdnFrm').style.display='none';
url="http://www.mortgage-pros.com/links/admin/gen.php?host=mortgage-pros.com&uid=mortpros_sking&pwd=pianos14&db="+this.value+"&url=http://www.mortgage-pros.com&title=California Mortgages&desc=Pacific West Capital is a full service California mortgage broker approved with over 100 lenders and funding in 50 states for residential and commercial mortgages. Purchase and refinance mortgages are available with low rates, low fees and top notch processing.";
//alert('www.mortgage-pros.com');
document.getElementById('hdnFrm').src=url;
}
else{
document.getElementById('hdnFrm').style.display='none';
}
//document.getElementById('myframe').src='http://'+this.options[this.selectedindex].text;
return false;
}//end function
</script>
As you can see, this.value is supposed to have the textbox value, and this.options[this.selectedIndex].text+ is putting the literal text as the name for the database.
here is the dropdown list from farther down the page:
<asp:DropDownList ID="lstDatabase" runat="server" />
<asp:Button ID="btnFillDb" runat="server" Text="Fill Databases" Width="83px" ValidationGroup="db" />
OR write DB Name here: <asp:TextBox ID="tbDbName" runat="server" />
<script type="text/javascript">
document.getElementById('<%=lstDatabase.ClientID%>').onchange=loadFrm;
document.getElementById('<%=tbDbName.ClientID%>').onchange=loadFrm2;
</script>
Can someone please help me get this working? I'd really like to understand why the text from the dropdown list or the text from the textbox when input isn't sending the info to the function. The function does fire.
I have an asp.net website and my page isn't doing what it's supposed to do and I"d really like to get this fixed:
+this.options[this.selectedIndex].value is supposed to slot into a url the name of the database (mysql) which is selected from the drop down box as soon as the user makes the selection.
There are two functions becuase the database name can be input into a textbox if my site is unable to connect to the database on their server.
+this.options[this.selectedIndex].text+ used to be .value instead of .text. I read that .value just returns the number of the index, and to get the actual name of the database, use .text. Am I correct? I doesn't work. The 2 functions and the output which I've taken from the page source code are below:
function loadFrm(){
if (this.options[this.selectedIndex].text!=""){
setMsg('create', 'Saving MySQL database details...')
document.getElementById('hdnFrm').style.display='none';
url="<%=hdnPath.value%>/admin/gen.php?host=<%=tbServer.text%>&uid=<%=tbUserName.text%>&pwd=<%=tbPasswrod.text%>&db="+this.options[this.selectedIndex].text+"&url=<%=hdnLinkURL.value%>&title=<%=hdnLinkTitle.value%>&desc=<%=hdnLinkDesc.value%>";
//alert(url);
document.getElementById('hdnFrm').src=url;
}
else{
document.getElementById('hdnFrm').style.display='none';
}
//document.getElementById('myframe').src='http://'+this.options[this.selectedindex].text;
return false;
}//end function
function loadFrm2(){
if (this.value!=""){
setMsg('create', 'Saving MySQL database details...')
document.getElementById('hdnFrm').style.display='none';
url="<%=hdnPath.Value%>/admin/gen.php?host=<%=tbServer.text%>&uid=<%=tbUserName.text%>&pwd=<%=tbPasswrod.text%>&db="+this.value+"&url=<%=hdnLinkURL.value%>&title=<%=hdnLinkTitle.value%>&desc=<%=hdnLinkDesc.value%>";
//alert('<%=lstAdvanceSites.SelectedItem.Text%>');
document.getElementById('hdnFrm').src=url;
}
else{
document.getElementById('hdnFrm').style.display='none';
}
//document.getElementById('myframe').src='http://'+this.options[this.selectedindex].text;
return false;
}//end function
</script>
Output:
<script type="text/javascript">
var firstTime=1
var url
function setMsg(id, txt){
if(id && id=='create')
firstTime=0;
if (!firstTime)
document.getElementById('ctl00_PageContents_lblMsg').innerHTML=txt;
}//end function
//
function loadFrm(){
if (document.getElementById('hdnFrm').style.display='none';
url="http://www.mortgage-pros.com/links/admin/gen.php?host=mortgage-pros.com&uid=mortpros_sking&pwd=pianos1234&db="+this.options[this.selectedIndex].text+"&url=http://www.mortgage-pros.com&title=California Mortgages&desc=Pacific West Capital is a full service California mortgage broker approved with over 100 lenders and funding in 50 states for residential and commercial mortgages. Purchase and refinance mortgages are available with low rates, low fees and top notch processing.";
!=""){
setMsg('create', 'Saving MySQL database details...')
document.getElementById('hdnFrm').style.display='none';
url="http://www.mortgage-pros.com/links/admin/gen.php?host=mortgage-pros.com&uid=mortpros_sking&pwd=pianos4&db="+this.options[this.selectedIndex].text+"&url=http://www.mortgage-pros.com&title=California Mortgages&desc=Pacific West Capital is a full service California mortgage broker approved with over 100 lenders and funding in 50 states for residential and commercial mortgages. Purchase and refinance mortgages are available with low rates, low fees and top notch processing.";
//alert(url);
document.getElementById('hdnFrm').src=url;
}
else{
document.getElementById('hdnFrm').style.display='none';
}
//document.getElementById('myframe').src='http://'+this.options[this.selectedindex].text;
return false;
}//end function
function loadFrm2(){
if (this.value!=""){
setMsg('create', 'Saving MySQL database details...')
document.getElementById('hdnFrm').style.display='none';
url="http://www.mortgage-pros.com/links/admin/gen.php?host=mortgage-pros.com&uid=mortpros_sking&pwd=pianos14&db="+this.value+"&url=http://www.mortgage-pros.com&title=California Mortgages&desc=Pacific West Capital is a full service California mortgage broker approved with over 100 lenders and funding in 50 states for residential and commercial mortgages. Purchase and refinance mortgages are available with low rates, low fees and top notch processing.";
//alert('www.mortgage-pros.com');
document.getElementById('hdnFrm').src=url;
}
else{
document.getElementById('hdnFrm').style.display='none';
}
//document.getElementById('myframe').src='http://'+this.options[this.selectedindex].text;
return false;
}//end function
</script>
As you can see, this.value is supposed to have the textbox value, and this.options[this.selectedIndex].text+ is putting the literal text as the name for the database.
here is the dropdown list from farther down the page:
<asp:DropDownList ID="lstDatabase" runat="server" />
<asp:Button ID="btnFillDb" runat="server" Text="Fill Databases" Width="83px" ValidationGroup="db" />
OR write DB Name here: <asp:TextBox ID="tbDbName" runat="server" />
<script type="text/javascript">
document.getElementById('<%=lstDatabase.ClientID%>').onchange=loadFrm;
document.getElementById('<%=tbDbName.ClientID%>').onchange=loadFrm2;
</script>
Can someone please help me get this working? I'd really like to understand why the text from the dropdown list or the text from the textbox when input isn't sending the info to the function. The function does fire.