Jump to content

vinphetamin

Members
  • Posts

    32
  • Joined

  • Last visited

vinphetamin's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. erm nope.Can you explain that one again please
  2. Try this:http://aspnet.4guysfromrolla.com/articles/032702-1.aspxor failing that Google; Access & .net
  3. Good stuff.Happy codingVin
  4. Like this: <%'------------------------------------'These Variables'------------------------------------selectWidth = 200 'width of select box in pixelsselectHeight = 200 'height of select box in pixelsselectAlpha = 80 'transparency of drop-down listselectBackgroundColor = "#00FF00" 'Background colour of drop down listselectHighlightColor = "#FF0000" 'background colour of option when mouse overselectTextHighlightColor = "#FFF" 'text colour of option when mouse over%><script language="javascript"> function showHide(){// if(document.getElementById('mySelectBox').style.visibility=="hidden"){// document.getElementById('mySelectBox').style.visibility='visible';// }else{// document.getElementById('mySelectBox').style.visibility='hidden';// } } function move_up() {// scroll_clipper.scrollTop = 0; }</script><style>input{border:none;cursor:pointer;width:100%;padding:2;background-color:transparent;}#customSelect{border:1px solid #c0c0c0;cursor:pointer;}</style><body bgcolor=#33CC33><form name="myForm" method=post><div style="position: absolute; z-index: 1" id="layer1"><div style="position: absolute; z-index: 1; visibility:visible" id="mySelectBox"> <div id='scroll_clipper' style='filter:alpha(opacity=<%=selectAlpha%>);position:absolute; width:<%=selectWidth%>px; height: <%=selectHeight%>px; overflow-y:auto'> <div id='scroll_text' style="background-color:<%=selectBackgroundColor%>;"> <table border="0" cellspacing=0 cellpadding=0 width="100%" id="table1"><%'------------------------------'DSN'------------------------------ set conn=server.createobject("ADODB.CONNECTION") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open(Server.Mappath("/db/northwind.mdb"))'------------------------------'Get data..'------------------------------ set rs = conn.execute("SELECT DISTINCT Country FROM Customers ORDER BY Country") while not rs.eof thisCountry = trim(rs(0)) %> <tr onclick="document.myForm.country.value='<%=thisCountry%>';move_up();showHide();myForm.submit();" style="cursor:pointer;" color="#FFFFFF" onmouseout="this.bgColor='';this.style.color = '';" onmouseover="this.bgColor='<%=selectHighlightColor%>';this.style.color='<%=selectTextHighlightColor%>';"> <td style="padding:0 0 1 2;"><%=thisCountry%></td> </tr> <%rs.movenext wEnd%> </table> </div> </div></div><input type="hidden" name="country" value="<%=trim(request("country"))%>" readonly /></div></form><%country = trim(request("country"))if country<>"" thensql="SELECT Customers FROM Customers WHERE country='" & country & "'"set rs=Server.CreateObject("ADODB.Recordset")rs.Open sql,conn %> <table width="100%" cellspacing="0" cellpadding="2" border="1"> <tr> <th>Customers</th> </tr> <% do until rs.EOF response.write("<tr>") response.write("<td>" & rs.fields("Customers") & "</td>") response.write("</tr>") rs.MoveNext loop%> </table><% end if %><%'------------------------------'Close conn..'------------------------------ rs.close set rs = nothing conn.close set conn = nothing%></body></html> ?
  5. Try and stop the page from being cached in the first place. Try putting this in the head of the page: <META HTTP-EQUIV="Pragma" CONTENT="no-cache"><META HTTP-EQUIV="Expires" CONTENT="-1">
  6. To remove the scrollbar(s) just alter the code fromoverflow-y : auto;tooverflow-y : none;or just delete it altogether.At the moment it is set to auto so it should only show if the list disappears beyond the viewable area.Is that what you meant?
  7. Yeah sorry about that, we closed the DSN conn and tried to use it again before reopening/declaring what conn was.I've moved the clean-up to the end of the script, try this one out: <%'------------------------------------'These Variables'------------------------------------selectWidth = 200 'width of select box in pixelsselectHeight = 200 'height of select box in pixelsselectAlpha = 80 'transparency of drop-down listselectBackgroundColor = "#00FF00" 'Background colour of drop down listselectHighlightColor = "#FF0000" 'background colour of option when mouse overselectTextHighlightColor = "#FFF" 'text colour of option when mouse over%><script language="javascript">function showHide(){ if(document.getElementById('mySelectBox').style.visibility=="hidden"){ document.getElementById('mySelectBox').style.visibility='visible'; }else{ document.getElementById('mySelectBox').style.visibility='hidden'; }}function move_up() { //scroll_clipper.scrollTop = 0;}</script><style>input{border:none;cursor:pointer;width:100%;padding:2;background-color:transparent;}#customSelect{border:1px solid #c0c0c0;cursor:pointer;}</style><body bgcolor=#33CC33><form name="myForm" method=post><div style="position: absolute; z-index: 1" id="layer1"><div style="position: absolute; z-index: 1; left:0px; top:22px; visibility:hidden" id="mySelectBox"><div id='scroll_clipper' style='filter:alpha(opacity=<%=selectAlpha%>);position:absolute; width:<%=selectWidth%>px; height: <%=selectHeight%>px; overflow-y:auto'> <div id='scroll_text' style="background-color:<%=selectBackgroundColor%>;"> <table border="0" cellspacing=0 cellpadding=0 width="100%" id="table1"> <% '------------------------------ 'DSN '------------------------------ set conn=server.createobject("ADODB.CONNECTION") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open(Server.Mappath("/db/northwind.mdb")) '------------------------------ 'Get data.. '------------------------------ set rs = conn.execute("SELECT DISTINCT Country FROM Customers ORDER BY Country") while not rs.eof thisCountry = trim(rs(0)) %> <tr onclick="document.myForm.country.value='<%=thisCountry%>';move_up();showHide();myForm.submit();" style="cursor:pointer;" color="#FFFFFF" onmouseout="this.bgColor='';this.style.color = '';" onmouseover="this.bgColor='<%=selectHighlightColor%>';this.style.color='<%=selectTextHighlightColor%>';"> <td style="padding:0 0 1 2;"><%=thisCountry%></td> </tr> <%rs.movenext wEnd %> </table> </div></div></div><table border="0" cellpadding=0 cellspacing=0 width="<%=selectWidth%>" id="customSelect"><tr onclick="myForm.country.select();showHide();"> <td width="100%"><input type="text" name="country" value="<%=trim(request("country"))%>" readonly /></td> <td align="right">V</td></tr></table></div></form><%country = trim(request("country"))if country<>"" then sql="SELECT Customers FROM Customers WHERE country='" & country & "'" set rs=Server.CreateObject("ADODB.Recordset") rs.Open sql,conn %> <table width="100%" cellspacing="0" cellpadding="2" border="1"> <tr> <th>Customers</th> </tr> <% do until rs.EOF response.write("<tr>") response.write("<td>" & rs.fields("Customers") & "</td>") response.write("</tr>") rs.MoveNext loop%> </table><% end if %><% '------------------------------ 'Close conn.. '------------------------------ rs.close set rs = nothing conn.close set conn = nothing%></body></html>
  8. You'll have to bear in mind that you'll probably be creating an infintite loop so you'd probably need to pass a variable round to counter-act it: <%if request("myVar")="" then response.redirect "?myVar=1"%> Also if you're trying to refresh the pages content you may want to look at doing it with java script:location.reload()or <script language="javascript"><!--if (location.search.indexOf("myVar")==-1){ location="?myVar";}//--></script>
  9. Try this: <%'------------------------------------'These Variables'------------------------------------ selectWidth = 200 'width of select box in pixels selectHeight = 200 'height of select box in pixels selectAlpha = 80 'transparency of drop-down list selectBackgroundColor = "#00FF00" 'Background colour of drop down list selectHighlightColor = "#FF0000" 'background colour of option when mouse over selectTextHighlightColor = "#FFF" 'text colour of option when mouse over%><script language="javascript"> function showHide(){ if(document.getElementById('mySelectBox').style.visibility=="hidden"){ document.getElementById('mySelectBox').style.visibility='visible'; }else{ document.getElementById('mySelectBox').style.visibility='hidden'; } } function move_up() { //scroll_clipper.scrollTop = 0; }</script><style> input{border:none;cursor:pointer;width:100%;padding:2;background-color:transparent;} #customSelect{border:1px solid #c0c0c0;cursor:pointer;}</style><body bgcolor=#33CC33><form name="myForm" method=post><div style="position: absolute; z-index: 1" id="layer1"><div style="position: absolute; z-index: 1; left:0px; top:22px; visibility:hidden" id="mySelectBox"> <div id='scroll_clipper' style='filter:alpha(opacity=<%=selectAlpha%>);position:absolute; width:<%=selectWidth%>px; height: <%=selectHeight%>px; overflow-y:auto'> <div id='scroll_text' style="background-color:<%=selectBackgroundColor%>;"> <table border="0" cellspacing=0 cellpadding=0 width="100%" id="table1"> <% '------------------------------ 'DSN '------------------------------ set conn=server.createobject("ADODB.CONNECTION") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open(Server.Mappath("/db/northwind.mdb")) '------------------------------ 'Get data.. '------------------------------ set rs = conn.execute("SELECT DISTINCT Country FROM Customers ORDER BY Country") while not rs.eof thisCountry = trim(rs(0)) %> <tr onclick="document.myForm.country.value='<%=thisCountry%>';move_up();showHide();myForm.submit();" style="cursor:pointer;" color="#FFFFFF" onmouseout="this.bgColor='';this.style.color = '';" onmouseover="this.bgColor='<%=selectHighlightColor%>';this.style.color='<%=selectTextHighlightColor%>';"> <td style="padding:0 0 1 2;"><%=thisCountry%></td> </tr> <%rs.movenext wEnd '------------------------------ 'Close conn.. '------------------------------ rs.close set rs = nothing conn.close set conn = nothing %> </table> </div> </div></div><table border="0" cellpadding=0 cellspacing=0 width="<%=selectWidth%>" id="customSelect"> <tr onclick="myForm.country.select();showHide();"> <td width="100%"><input type="text" name="country" value="<%=trim(request("country"))%>" readonly /></td> <td align="right">V</td> </tr></table></div></form><%country = trim(request("country")) if country<>"" then sql="SELECT Customers FROM Customers WHERE country='" & country & "'" set rs=Server.CreateObject("ADODB.Recordset") rs.Open sql,conn %> <table width="100%" cellspacing="0" cellpadding="2" border="1"> <tr> <th>Customers</th> </tr> <% do until rs.EOF response.write("<tr>") response.write("<td>" & rs.fields("Customers") & "</td>") response.write("</tr>") rs.MoveNext loop rs.close conn.Close set rs=Nothing set conn=Nothing%> </table> <% end if %></body></html> You're going to need to modify the aesthetics of the table to make it look like a select box. (Meantime; I’ve put a V to represent an arrow).This form now submits when the user makes a selection. When the form is submitted country is posted as a variable which the code now checks for. If country is something then your code will run to look up the customers.I don’t have any database connectivity here so I couldn’t test this since I modified it. You’ll have to let me know how you get on.CheersVin
  10. I think it may have been the values:<tr onclick="document.myForm.country.value='<%=thisCountry%>';There were no quotes around them before.If you copy the following and save it as an asp page it should work.Can you try this and see if it works at your end: <%Dim testArray(50) for i = 0 to 50 testArray(i)="Test country "&i next%><script language="javascript"> showVar=null; function showHide(){ if(document.getElementById('mySelectBox').style.visibility=="hidden"){ document.getElementById('mySelectBox').style.visibility='visible'; }else{ document.getElementById('mySelectBox').style.visibility='hidden'; } } function hideSelect(){ //setTimeout("document.getElementById('mySelectBox').style.visibility='hidden'",100) } function move_up() { //scroll_clipper.scrollTop = 0; }</script><body><form name="myForm"><div style="position: absolute; z-index: 1" id="layer1"><div style="position: absolute; z-index: 1; left:-1px; top:24px; visibility:hidden" id="mySelectBox"> <div id='scroll_clipper' style='filter:alpha(opacity=80);position:absolute; width:150px; height: 100px; overflow-y:auto'> <div id='scroll_text' style="background-color:#00FF00;"> <table border="0" cellspacing=0 cellpadding=0 width="100%" id="table1"> <% For i=0 to ubound(testArray) thisCountry = testArray(i) %> <tr onclick="document.myForm.country.value='<%=thisCountry%>';move_up();showHide();" style="cursor:pointer;" color="#FFFFFF" onmouseout="this.bgColor='';this.style.color = '';" onmouseover="this.bgColor='#FF0000';this.style.color = '#ffffff';"> <td><%=thisCountry%></td> </tr> <%next%> </table> </div> </div></div><input type="text" name="country" value="" readonly onclick="this.select();showHide();" onblur="hideSelect();" style="cursor:pointer;" /></div></div><br /><br /><input type=submit value="Show Customers" /></form></body></html> CheersVin
  11. Can you paste your code and the error message in it's entirety so I can have a look.CheersVin
  12. Hi,yes, that was my mistake for changing the name of the text-box to 'country' following your code.Can you try this and see if this works: <script language="javascript"> showVar=null; function showHide(){ if(document.getElementById('mySelectBox').style.visibility=="hidden"){ document.getElementById('mySelectBox').style.visibility='visible'; }else{ document.getElementById('mySelectBox').style.visibility='hidden'; } } function hideSelect(){ //setTimeout("document.getElementById('mySelectBox').style.visibility='hidden'",100) } function move_up() { //scroll_clipper.scrollTop = 0; }</script><body><form name="myForm"><div style="position: absolute; z-index: 1" id="layer1"><div style="position: absolute; z-index: 1; left:-1px; top:24px; visibility:hidden" id="mySelectBox"> <div id='scroll_clipper' style='filter:alpha(opacity=80);position:absolute; width:150px; height: 100px; overflow-y:auto'> <div id='scroll_text' style="background-color:#00FF00;"> <table border="0" cellspacing=0 cellpadding=0 width="100%" id="table1"><%'------------------------------'DSN'------------------------------ set conn=server.createobject("ADODB.CONNECTION") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open(Server.Mappath("/db/northwind.mdb"))'------------------------------'Get data..'------------------------------ set rs = conn.execute("SELECT DISTINCT Country FROM Customers ORDER BY Country") while not rs.eof thisCountry = trim(rs(0)) %> <tr onclick="document.myForm.country.value=<%=thisCountry%>;move_up();showHide();" style="cursor:pointer;" color="#FFFFFF" onmouseout="this.bgColor='';this.style.color = '';" onmouseover="this.bgColor='#FF0000';this.style.color = '#ffffff';"> <td><%=thisCountry%></td> </tr> <%rs.movenext wEnd'------------------------------'Close conn..'------------------------------ rs.close set rs = nothing conn.close set conn = nothing%> </table> </div> </div></div><input type="text" name="country" value="" readonly onclick="this.select();showHide();" onblur="hideSelect();" style="cursor:pointer;" /></div></div><br /><br /><input type=submit value="Show Customers" /></form></body></html>
  13. <style> a{cursor:pointer;}</style><form id="myForm"> <input type="text" name="myField" /></form><a onclick="document.getElementById('myForm').myField.value='One';">One</a><br /><a onclick="document.getElementById('myForm').myField.value='Two';">Two</a><br /><a onclick="document.getElementById('myForm').myField.value='Three';">Three</a><br />
  14. vinphetamin

    detect SSL

    <%if request.servervariables("server_port_secure") then%>SSL<%else%>NOT SSL<%end if%>
  15. Can you paste the code from the aspx page. It may be possible to rewrite it.
×
×
  • Create New...