Jump to content

kastellu

Members
  • Posts

    39
  • Joined

  • Last visited

Posts posted by kastellu

  1. Yes that is what i meant about scroll-bar, but could i do that the select box would be open all the time, withoud pressing it , so that it would look like a menu?K

  2. Waw!!! :) It works great, now i have total control on select object :) and i can update it over the DB. Thank you for taking time,... What do u sugest me to do , so that i could use dropdown box ###### menu , I would change colors , and put open select box on one side , there is no problem with organization for me, but the problem how to change it to "open" select box with no scrollbars ,...Thanks again!K

  3. <%'------------------------------------'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> [/code]---------------------------------------------------------------------Hello Vin,O.K. , when i make a selection an error accures in IETechnical Information (for support personnel)Error Type:ADODB.Recordset (0x800A0E7D)The connection cannot be used to perform this operation. It is either closed or invalid in this context./document.asp, line 91Browser Type:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727) Page:POST 13 bytes to /document.aspPOST Data:country=country1I have bold the line 91, i don t have a clue what hte problem is.Sorry for bothering you with this , but i am really happy cause you are helpping me!!!Thanks,K

  4. Hi Vin,Yes the problem was in quotes,... , now the code works fine. Im trying to get results of the selected value, so i did it like this, but the problem is that when i press button no results ,hmm... This is my code now , the last part i put so i could get results from the first part, but there is no result?, eaven that your code gives me in address the result like this: http://localhost:90/document.asp?country=country1P.S. Two more questions, what i would need to change that the drop down box would look ###### select box as menu , and when i would click on the value , there i wouldn t need any button ?Thanksmy code:<html><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><%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.EOFresponse.write("<tr>")response.write("<td>" & rs.fields("Customers") & "</td>")response.write("</tr>")rs.MoveNextlooprs.closeconn.Closeset rs=Nothingset conn=Nothing%></table><% end if %></body></html>

  5. Can you paste your code and the error message in it's entirety so I can have a look.CheersVin

    Vin,My code is only the copy of your copy from last post. When i pres on a textbox , the drop down accures , after i press on one of the selections , nothing happens, but down on the lef side , an yellow logo that represent an error of a script shows ( as part of IE ) , when i look at it , there is an arror that tells that the chosen selection us undefined. Should i do someting more with this code? Because i am only a beginer in asp and java , when i look at this code , i looks like something is missing, the part which would export data in tables. I tried to combine your code with my example at first post, but no luck :) And something else:When i select from dropdown , the selection is not written in to text box. Only when i select the first value , works, but when i press button ther is no data shown.Thanks
  6. Hi Vin,A new error acured , when you click on one of the selections in box, IE writes for example: ´country1´ is undefinedis me that did something wrong or,... because , the only thing that i did was, that i created the same db and document.asp file with this code.hmmm :)

  7. Hello!!!Thank you for this code. But still i have a problem with selection, because, when i would like to make an selection, there is an error , if i check the error in an IE it is written something like this: document.myForm.mySelect.value an object is null or not an objectDo u know what is wrong?Thanks againK

  8. HEllo,I have a problem! I am using an example of selecting from DB with select box , what i would like to do is that i would change an view of selectbox with some modfied java menu. U need to know that slect is not an option or option group , but it works directly from DB and by changing an slectbox you create an filter of selection, the example is from w3school. The problem is , how to change or modify the select function with java or something else to get view you would like ( the problem is because i would like to hide borders of selectbox , but this is not possible not with css and IE ).Slect code , that work prfectly:<html><body><%set conn=Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open(Server.Mappath("/db/northwind.mdb"))set rs=Server.CreateObject("ADODB.recordset")sql="SELECT DISTINCT Country FROM Customers ORDER BY Country"rs.Open sql,conncountry=request.form("country")%><form method="post">Choose Country <select name="country"><% do until rs.EOF response.write("<option") if rs.fields("country")=country then response.write(" selected") end if response.write(">") response.write(rs.fields("Country")) rs.MoveNextlooprs.Closeset rs=Nothing %></select><input type="submit" value="Show customers"></form><%if country<>"" then sql="SELECT Companyname,Contactname,Country 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>Companyname</th> <th>Contactname</th> <th>Country</th> </tr><%do until rs.EOF response.write("<tr>") response.write("<td>" & rs.fields("companyname") & "</td>") response.write("<td>" & rs.fields("contactname") & "</td>") response.write("<td>" & rs.fields("country") & "</td>") response.write("</tr>") rs.MoveNextlooprs.closeconn.Closeset rs=Nothingset conn=Nothing%></table><% end if %></body></html>and JAVA that i would like to use: can you give me an exampleThank you

  9. Hello I inserted your code, but i am not any good in programing, can you check it, where i did a mistake, please.<html><body><%set conn=Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open(Server.Mappath("_DB/baza.mdb"))set rs=Server.CreateObject("ADODB.recordset")sql="SELECT DISTINCT NazivSkupine FROM tblStoritve ORDER BY NazivSkupine"rs.Open sql,connNazivSkupine=request.form("NazivSkupine")%><form method="post">Izberi NAzivSkupine <select name="NazivSkupine"><% do until rs.EOF response.write("<option") if rs.fields("NazivSkupine")=NazivSkupine then response.write(" selected") end if response.write(">") response.write(rs.fields("NazivSkupine")) rs.MoveNextlooprs.Closeset rs=Nothing %></select><input type="submit" value="Potrdi"></form><%if NazivSkupine<>"" then sql="SELECT NazivSkupine,NazivPodskupine FROM tblStoritve WHERE NazivSkupine='" & NazivSkupine & "'" set rs=Server.CreateObject("ADODB.Recordset") rs.Open sql,conn%> <table width="100%" cellspacing="0" cellpadding="2" border="1"> <tr> <th>NazivPodskupine</th> <th><!--I think that it should be here instead of previous field NazivSkupine ( NazivSkupine is field that i am trying to get only once --><%NazivSkupine=""while not YourRecordsetRS.eofif NazivSkupine<>YourRecordsetRS("NazivSkupine") then%><td><%=YourRecordsetRS("NazivSkupine")%> </td><%else%><td> </td><%NazivSkupine = YourRecordsetRS("NazivSkupine")YourRecordsetRS.movenextEnd%></th> </tr><%do until rs.EOF response.write("<tr>") response.write("<td>" & rs.fields("NazivPodskupine") & "</td>") response.write("<td>" & rs.fields("NazivSkupine") & "</td>") response.write("</tr>") rs.MoveNextlooprs.closeconn.Closeset rs=Nothingset conn=Nothing%></table><% end if %></body></html>

  10. Hello,How i could create export from DB on html (asp) that would look like this.DB table tblItem looks like this:ItemID Item subItem--------------------------------1 ItemA sub12 ItemA sub23 ItemA sub34 ItemB sub45 ItemB sub56 ItemB sub6...What i would like is this kind of exported data in html table:ItemA: -sub1<blank space> -sub2<blank space> -sub3ItemB: -sub4<blank space> -sub5 <blank space> -sub6But now i get:ItemA: -sub1ItemA: -sub2ItemA: -sub3Thank you for help!kastellu

  11. Hello,I have created an DB with some news, since i am reading this new from DB on a form <td>news</td> i have problem of setting the <td> to size of a row to only for 30 caraters and after that the <td> would colapse in to new row and so on. So what i am trying to do is that the <td> would be set to right leng for every row of a news. When i get the new on a form is always written out of the size i would like and the structure of the whole page is destroyed. So what to do? Please help me.Example:<!--First news--><tr> <td valign="top" class="text_1" style="width: 70px; height: 51px" colspan="0"><span class="text_2"><%=rs("date")%>-<%=rs("name")%></span><br><%=rs("description")%></td></tr> <!--line--><tr><td height="14" valign="top" style="width: 543px"><img src="slike/4ozadje.gif" height="1" style="width: 184px"></td></tr><!--Second news--><tr width="70px"> <td height="51" valign="top" class="text_1" style="width: 70px" colspan="0"><span class="text_2" ><%=rs("date")%>-<%=rs("name")%></span><br><%=rs("description")%></td></tr>thank you

×
×
  • Create New...