From: Rob Christiansen on 21 Feb 2010 18:32 In this code snippet javascript reads data frrom the file and prints it to the screen. The problem here is that I can't make one record's feilds line up in nice neat verticle columns with other record's feilds. I've tried <TABLE> commands and <COLGROUP> commands and ALL KINDS OF STUFF but invariably only get more and more confused. Please show me the way. Response.Write( rs("id").Value ) Response.Write( ") "+ rs("prevrec").Value ) Response.Write( " "+ rs("nextrec").Value ) Response.Write( " "+ rs("sforegrnd").Value ) Response.Write( " "+ rs("sbackgrnd").Value ) Response.Write( " "+ rs("sshow").Value ) Response.Write( " "+ rs("sname").Value ) Response.Write( " "+ rs("smessage").Value ) Response.Write( ".....["+ rs("sclient").Value ) Response.Write( "]..... "+ rs("sa").Value ) Response.Write( " "+ rs("sb").Value ) Response.Write( " "+ rs("sc").Value ) Response.Write( " "+ rs("sd").Value ) Response.Write( " "+ rs("se").Value ) Response.Write( ""+ rs("sf").Value ) Response.Write( " "+ rs("sg").Value ) Response.Write( " "+ rs("sh").Value ) Response.Write( " "+ rs("sj").Value ) Response.Write( " "+ rs("sk").Value ) Response.Write( " "+ rs("sL").Value ) Response.Write( " "+ rs("sm").Value ) Response.Write( " "+ rs("sN").Value ) Response.Write( "<hr>" ) } //28 rs.MoveNext( ); } //567 *** Sent via Developersdex http://www.developersdex.com ***
From: Evertjan. on 22 Feb 2010 04:30 Rob Christiansen wrote on 22 feb 2010 in comp.lang.javascript: > In this code snippet javascript reads data frrom the file and prints it > to the screen. The > problem here is that I can't make one record's feilds line up in nice > neat verticle columns with > other record's feilds. I've tried <TABLE> commands and <COLGROUP> > commands and ALL KINDS OF STUFF > but invariably only get more and more confused. Please show me the way. > > > Response.Write( rs("id").Value ) > Response.Write( ") "+ rs("prevrec").Value ) > Response.Write( " "+ rs("nextrec").Value ) > Response.Write( " "+ rs("sforegrnd").Value ) > Response.Write( " "+ rs("sbackgrnd").Value ) > Response.Write( " "+ rs("sshow").Value ) > Response.Write( " "+ rs("sname").Value ) > Response.Write( " "+ rs("smessage").Value ) > Response.Write( ".....["+ rs("sclient").Value ) > Response.Write( "]..... "+ rs("sa").Value ) > Response.Write( " "+ rs("sb").Value ) > Response.Write( " "+ rs("sc").Value ) > Response.Write( " "+ rs("sd").Value ) > Response.Write( " "+ rs("se").Value ) > Response.Write( ""+ rs("sf").Value ) > Response.Write( " "+ rs("sg").Value ) > Response.Write( " "+ rs("sh").Value ) > Response.Write( " "+ rs("sj").Value ) > Response.Write( " "+ rs("sk").Value ) > Response.Write( " "+ rs("sL").Value ) > Response.Write( " "+ rs("sm").Value ) > Response.Write( " "+ rs("sN").Value ) > Response.Write( "<hr>" ) >} //28 > > rs.MoveNext( ); >} //567 something like this? Not tested, jscript assumad, these are the essentials. ==================================== <% var fieldArray = [ 'id', 'prevrec','nextrec','sforegrnd','sbackgrnd', 'sshow','sname','smessage','sclient', 'sa','sb','sc','sd','se','sf', 'sg','sh','sj','sk','sL','sm' ]; function getField(fieldName){ getField = rs(fieldName).Value; }; function writeField(fieldName){ Response.write('<td>'+getField(fieldName)); }; function writeRow(){ Response.write('\n<tr>'); for (var i=0,i<fieldArray.length,i++) writeField(fieldArray[i]); }; %> <style type='text/css'> table.t tr td {width:80px;} </style> <table border=1 id=t> <% Response.write('<thead><tr>'); // header for (var i=0,i<fieldArray.length,i++) Response.write('<td>'+fieldArray[i]; Response.write('\n<tbody>'); while (!rs.eof) { // rows writeRow(); rs.MoveNext( ); }; %> </table> ==================================== -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
From: Rob Christiansen on 24 Feb 2010 17:29 Here is entire script. I want it to print out in neat verticle columns. Error message - "Microsoft JScript runtime error '800a1391' 'response' is undefined /santa/tryasp.asp, line 101 " . . . which is strange because i've never had trouble with 'response' before. Your code is very eligant! .. i have another question - i write this asp code on my winXP computer, upload it onto my websitemy and run it online. That's a real pain, though! i'd like to run it off-line. i guess i need an IIS? Windows NT 4.0 Option Pack has been suggested. Would that do the trick? . ----------------------- <%@ Language=JavaScript %> <HTML> <HEAD> <TITLE> example line up fields in columns </TITLE> </HEAD> <BODY bgColor= yellow leftMargin=50 text= blue LINK= black VLINK= red ALINK= palegreen > <! bgColor= black white gray yellow lime red brown blue orange pink purple > <! aqua magenta maroon mintcream navy olive orchid palegreen peru > <! sienna -(brown) silver tan tomato wheat cyan Gold > <FONT size=2 FACE="Times New Roman"> <form action= "<% = this_script_url %>" > <% var databasename = "santa.mdb"; var to_do = String( Request("to_do" ) ); var RecnumToModify= String( Request("RecnumToModify" ) ) var newprevrec = String( Request( "prevrec" ) ); var newnextrec = String( Request( "nextrec" ) ); var newforegrnd = String( Request( "sforegrnd" ) ); var newbackgrnd = String( Request( "sbackgrnd" ) ); var newshow = String( Request( "sshow" ) ) var newbuyer = String( Request( "sname" ) ) var newmessage = String( Request( "smessage" ) ) var newclient = String( Request( "sclient" ) ) var newa = String( Request( "sa" ) ) var newb = String( Request( "sb" ) ) var newc = String( Request( "sc" ) ) var newd = String( Request( "sd" ) ) var newe = String( Request( "se" ) ) var newf = String( Request( "sf" ) ) var newg = String( Request( "sg" ) ) var newh = String( Request( "sh" ) ) var newj = String( Request( "sj" ) ) var newk = String( Request( "sk" ) ) var newL = String( Request( "sL" ) ) var newm = String( Request( "sm" ) ) var newN = String( Request( "sN" ) ) var this_script_url = String( Request.ServerVariables("SCRIPT_NAME")); if( to_do == "undefined" ) //------------ STEP 1 radio-button the record to modify ------------------------------------------------------------------------ - { //30 var RelativePathToAccessFile = databasename; var AbsolutePathToAccessFile = Server.MapPath( RelativePathToAccessFile ); var FSO = Server.CreateObject("Scripting.FileSystemObject"); var ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" + AbsolutePathToAccessFile + ";"; var ConnectionObject = Server.CreateObject("ADODB.Connection"); ConnectionObject.Open( ConnectionString ); var sql = "SELECT * FROM santa1 "; //Response.Write( "<br>1) "+ sql+"<br>" ); var rs = Server.CreateObject("ADODB.RecordSet"); rs.Open (sql, ConnectionObject); // RS = ConnectionObject.Execute( sql ); var fieldArray = [ 'id', 'prevrec','nextrec','sforegrnd','sbackgrnd', 'sshow','sname','smessage','sclient', 'sa','sb','sc','sd','se','sf', 'sg','sh','sj','sk','sL','sm' ]; function getField( fieldName ) { getField = rs( fieldName ).Value; }; function writeField( fieldName ) { response.write( '<td>'+ getField( fieldName ) ); }; function writeRow() { response.write( '\n <tr>' ); for ( i=0; i < fieldarray.length; i++ ) writeField( fieldArray[i] ); }; %> <style type = 'text/css' > table.t tr td { width:80px; } </style> <table border=1 id=t> <% response.write( '<thead> <tr>' ); // header for ( i=0; i < fieldarray.length; i++) response.write( '<td>'+ fieldArray[ i ] ); response.write( '\n <tbody>' ); while ( !rs.eof ) { // rows writeRow(); rs.MoveNext( ); }; %> </table> <P> <form action= "<% = this_script_url %>" > <input type=hidden name= "to_do" value= "EditRecnum" > <input type=submit name="Submit Button" value=" Modify >>> "> </form> <P> <% rs.Close(); ConnectionObject.Close(); }//50 //end if( to_do == "Modify" ) %> </BODY> </HTML> *** Sent via Developersdex http://www.developersdex.com ***
From: Evertjan. on 25 Feb 2010 17:51 Rob Christiansen wrote on 24 feb 2010 in comp.lang.javascript: > Here is entire script. I want it to print out in neat verticle columns. > Error message - > "Microsoft JScript runtime error '800a1391' > 'response' is undefined > /santa/tryasp.asp, line 101 " What is line content 101's content? > . . . which is strange because i've never Try: Response. > had trouble with 'response' before. Perhaps you used VBS then? > Your code is very eligant! Whose code? What code? [please always quote on usenet] > i have another question Please start new Qs in a new thread. Thread drifting, though common on some NGs, should be discouraged here. > i write this asp code on my winXP computer, Don't do that, ASP code needs to run on a website, using it locally under IIS can be done, but is no real substitute for debugging. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
|
Pages: 1 Prev: no investment earn part time Next: FAQ Topic - How do I make a 10 second delay? (2010-02-22) |