i have created a page which displays all the records from a database and displays it as a table.the last column contains a drop-down list which is not populated.on calling the prior_login() function which checks for pwd=666 , i try to populate it, but get the following error message –>
Document.FormName.ElementName.options is Null/Not an Object .
i have tried the same which disabled the dropdown list and enabling on pwd=666 but the rows are unaffected. Can u tell me where i need to make changes so that i change either populate the drop down list in the JScript fucn or enable it here.
[code]
<html><head><title>JScript</title>
<script Language=JScript>
function prior_login()
{
var v_pwd=prompt(‘Enter Password to Sign-In as Verifier’);
if(v_pwd==666)
{
option0 =’abc;
option1 =’def’;
option2 =’ghi’;
document.form1.V1.options[0] = option0;
document.form1.V1.options[1] = option1;
document.form1.V1.options[2] = option2;
}
}
</script>
</head>
<%
Dim v_variables
Dim objConn,objRS,V_STR,V_SQL
Set objConn=Server.CreateObject(“ADODB.Connection”)
Set objRS=Server.CreateObject(“ADODB.Recordset”)
V_STR=”DSN=dsnname;”
V_SQL=”SELECT columnames FROM tablename;”
objConn.Open(V_STR)
Set objRS=objConn.Execute(V_SQL)
%>
<body>
<form name=”form1″ method=post action=”self.asp”>
<p align=”center”><b><font color=”#C0C0C0″ size=”5″ face=”Baskerville Old Face”>JScript </font></b></p>
<table border=”1″ width=”59%” id=”table1″>
<% Do while NOT objRS.EOF %>
<tr><td bgcolor=”#FFFFFF” width=”187″>
<input id=”txt1″ type=”text” value=”<%=objRS(“col1″)%>” size=”25″ name=”txt1″></td><td bgcolor=”#FFFFFF” width=”208″>
<input id=”Date1″ type=”text” value=”<%=objRS(“col2″)%>”size=”25″ name=”Date1″></td><td bgcolor=”#FFFFFF” width=”74″>
<input type=textbox name=”OT1″ value=”<%=objRS(“col3″)%>” style=”font-family: Arial Unicode MS”></td><td bgcolor=”#FFFFFF” width=”92″>
<input type=textbox name=”S1″ value=”<%=objRS(“col4″)%>” style=”font-family: Arial Unicode MS”></td><td bgcolor=”#FFFFFF”>
<select OnClick=”prior_login()” size=”1″ name=”V1″ style=”font-family: Arial Unicode MS;”>
<option value=”Default”>Default</option>
</select></td></td></tr>
<%
objRS.MoveNext
Loop
%></table>
</form>
</body>
<%
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
%>
</html>