Jump to content

crazyswede

Members
  • Posts

    57
  • Joined

  • Last visited

Posts posted by crazyswede

  1. I’m going to need some help navigating your website. For example, I recently went in there to find out about the File object and its members. I couldn't find a thing - Simple little thing like that. Can you help me out? Is there a book or article  or something I can read?

     

  2. <%@ Language=JavaScript %>

    <HTML>

    <HEAD>

    1. Here, I’m guessing that “href=” section below refers to where the program goes to get the file to download from the server.

    2. The “download=” section  I’m guessing Is where I tell the program where to  download that file on my computer.

    3. I'm not entirely sure what the “img src=” section is for but we're not working with images so  I am guessing I can leave in out

    <a href="http://ccs2468.com/books/books09.mdb" download="c:books09.xxx"> </a>

    <! img src="/images/myw3schoolsimage.jpg" alt="W3Schools">

    </a>

    4) I tried this too with no luck.

    <a href="/books/books09.mdb" download="c:books09.xxx"> </a>

    Done <-- I put this in just To show me that the program has run. 

    But I run the program and then check on the computer, and nothing has been downloaded. what am I doing wrong?

    </BODY>

    </HTML>

  3. Okay, I have several programs I wrote in ASP (classic)/JavaScript that I run on my website, feeding from and  storing to MDB and txt files stored on the server. I Periodically want to download and save these files on my computer.  Right now, I have to fire-up my big, elaborate FTP system - a long and lengthy process. I was wondering if (and how) I could write a program so I could just click on a button on my screen and download the file? Just point me in the right direction and I will figure it out.

  4. I’m Working with classic asp.

    Great! 😀 Can you help me out with an address where I can study console()?  I apparently don't know how to do this. I Google Console() and I get a bunch of links. I click a link and I just get more likes. Click again and I just get more links. . . And on and on and on.

    On 9/30/2018 at 4:41 AM, john_jack said:

     

  5. This is very frustrating. Using session I can store variables in the computer, and then recover them in the new instance Without having to pass them through the URL. But at that point it appears that I can only print the value of the variables, whereas I need to load that value into a variable that I can then manipulate and work with. W3schools help page Specifically shows  that can be done., but it does not work for me. Is there something I'm doing wrong?

    ----------------------------------

    ExistContents = "Exist";

    newContents= "new";

    %>

    <div id="result1"></div>

    <script>

    sessionStorage.setItem( "ExistContents", "<%Response.Write( ExistContents )%>" )

    </script>

     

    <div id="result2"></div>

    <script>

    sessionStorage.setItem( "newContents", "<%Response.Write( newContents )%>" )

    </script>

     

    <input type=hidden name= "to_do" value= "WriteEdit"  >

    <input type="submit" value="Submit">

     

    <%

    } //23

     

    if( to_do == "WriteEdit" )

    { //100

    %>

    <div id="result1"></div>

    <script>

       document.getElementById("result1").innerHTML = sessionStorage.getItem("ExistContents");

    </script>

     

    <div id="result2"></div>

    <script>

       document.getElementById("result2").innerHTML = sessionStorage.getItem("newContents");

    </script>

    [So far all works great!]

     

    <div id="result1"></div>

    <script>

        var file1 = sessionStorage.getItem("ExistContents" ) <---  W3schools help page Specifically shows that can be done., but it does not work for me. Down below I print the value of file1, but I get undeclared identifier. 😩

    </script>

     

    <div id="result2"></div>

    <script>

        var file2 = String( sessionStorage.getItem( "newContents" ) ) <-- I tried something else, here, which didn't work either

    </script>

    <%

    Response.Write( "file1= "+ file1 +"<br>" )

    Response.Write("file2= "+ file2 +"<br>" )

  6. It's good to hear this should work. I have had  the most success with this code -

    //--- try 4 -- -------------

    ExistContents= “existing”;

    <textarea cols=100 rows=20 >

    <script>

    localStorage.setItem("NewContents",<%Response.Write( ExistContents ) %> )

    </script>

    </textarea >

    <br>

    //------------------

     

    <textarea> works fine, but then it prints out the localStorage command as though it were text, instead of Executing it. So then I tried this -

     

    //--- try 5 -- -------------

    ExistContents= “existing”;

    <textarea cols=100 rows=20 >

    <%Response.Write( <script> localStorage.setItem( "NewContents", "ExistContents" ) </script> ) %>

    </textarea >

    <br>

    //------------------

    . . . But that works no better.

  7. Got it.! I incorporated the <session> into an asp program, two if-blocks (I call those “instances”). In the first block I assign a value to my variable - (ExistingContents = “existing”). Using session object I then file that variable away in the computer. After clicking submit, the second block extracts the value and prints it - A simple little program that doesn't really do anything. At least I  now know it can be done.

     

    What I need is  to be able to edit the contents of “ExistingContents” with my keyboard And then have session file it  away in the computer. In the past I've done this using <textarea>. I have tried for hours and hours and hours to figure out a way to Mix  <textarea> with <session>, but with no luck. If I keep them separate, then one works but the other doesn't. I'm Wondering, Maybe I'm using the wrong functions. Is there possibly a different function or set of functions that would do these two  operations without screwing each other up?

  8. I have a program right now that reads a file off my computer into <textarea>, I modify it, and then pass it all to another if-block, that then writes it all back to the file. And  that works. The problem arises when I try to pass too much data. I calculate that I can pass 250 characters - any more and the program will crash. What if I have a file with several thousand characters?  I thought maybe if I make my variable global, I could avoid the matter of passing anything. Global variables though are very frustrating, no one will help me, and I haven't got the time to screw around with this thing. So I was looking into “textarea,” Apparently, after I click submit, it seems that I can tell The computer to write everything to the file. Is that correct? In another program I can then open that file, get the data out, and write it all to the file.

    Below are the two programs. The second program, I just print the contents of the file - but I get FILE NOT FOUND. please what am I doing wrong?

     

    ------------ testpass.htm --------------

    <!DOCTYPE html>

    <html>

    <body>

     

    <form action="/action_page.php">

     Text:<br>

     <textarea name="explanation"dirname="explanation.dir"></textarea>

     <input type="submit" value="Submit">

    </form>

     

    <p>When the form is being submitted, the text direction of the textarea will also be submitted.</p>

     

    </body>

    </html>

    ------------ testpass.asp --------------

    <%@ Language=JavaScript %>

    <%

    var URLname  = "E:\\web\\ccs2468com0\\htdocs\\action_page.php";

     

    var ForReading = 1, ForWriting = 2, ForAppending = 8;

    var abs_path = String(Request.ServerVariables("PATH_TRANSLATED"));

    var file_to_open =  URLname ;

    fso = new ActiveXObject("Scripting.FileSystemObject"); ; //<--FILE NOT FOUND

    fs_stream = fso.OpenTextFile (file_to_open, ForReading )

    ExistContents = fs_stream.ReadAll(); //fs_stream.Write( MemoContents +" \r\n" );

    fs_stream.close();

     Response.Write( "ExistContents= "+ ExistContents +"<br>" ); ;

     %>

  9. I seem to be having trouble navigating your website. I want to find information about a specific topic - for example Session, Object, File management, etc. In the past I would simply go your website, type in a few keywords into the search engine, and it would give me all the information I would need to know. Now I do that and it says CANNOT FIND. Could someone please help me? Where can I read the instructions on this?   😥

     

  10. It sure is a good thing you're there to help me with these things! I would never have known about sessions. So Below is what I found on the web - I get nothing but a blank screen, no errors, just a blank screen. It should print the value of sessions, shouldn’t it -  “ID” and “code?” Can you tell me what I'm doing wrong?

    ----------------- testSession.asp ----------

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>

    <%

    Session("id")=1234

    Session("code")="ZZ"

    %>

    ----------------- testSession.htm (this is what I run) ----------

    <html> <head></head> <body> <script type="text/javascript" src="asp/testSession.asp">

    alert("Session ID " + Session("id"));

    </script> </body>

  11. The below is the full, working code. You can copy and paste and run it, or you can run it on my website -

    http://ccs2468.com/msc/genesis.test.asp?to_do=EditEntry

    --------------------------------------------------------

    <%@ Language=JavaScript %>

    <HTML> <HEAD>

     

    <TITLE>Genesis.test.asp?to_do=EditEntry</TITLE>

     

    </HEAD><BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080">

     

    <form action= "<% =  this_script_url %>" >

    <% 

    var this_script_url = String( Request.ServerVariables("SCRIPT_NAME"));

     

    var to_do         = String( Request.QueryString( "to_do" ) );

     var datamessage = "global";;//<--- I ESTABLISH THE GLOBAL VARIABLES

    Recnum=1

     

    if( to_do == "EditEntry" )

    { //33

    Response.Write( “before modify ”+ Recnum +") datamessage "+ datamessage +" <br>" ); //<--datamessage=  “global”, Recnum= 1,  like it should be

     

    datamessage = "pppppppppppppppp"; //←- It apparently doesn't know there is a global variable by the same name, so it creates a new local variable, while the global one remains unchanged.

     

    Recnum = 37; //<-- I change the value of a global integer as well, although it doesn't matter, it's the same. String or integer, it doesn't matter.

     

    Response.Write( “after modify ”+ Recnum +") datamessage = "+ datamessage +" <br>" ); //← these are the values of the local variables, while the global ones remain unchanged.

     %>

    <FONT size =6 FACE="Copperplate Gothic Bold"

    <P ALIGN="center" ><B>Edit List</B><br>

    <FONT size=5 FACE="Times New Roman" >

    <p>

     <textarea cols=100 rows=20 >

    <%Response.Write( datamessage ) %>

    </textarea ><br>

     

    <input type=hidden name="to_do"   value= "WriteEntry">

    <input type=submit  value="Save">

    <%

    } //33

     

    if( to_do == "WriteEntry" )

    { //24B

    Response.Write( “in WriteEntry datamessage = "+ datamessage +" <br>" );

    Response.Write( “in WriteEntry Recnum = "+ Recnum +" <br>" ); //← ....global variables remain unchanged. 

     } //24B

     

    %>

     

    </BODY></HTML>

     

  12. classic ASP - javascript

    -------------------------------

    var datamessage = "global"; [<--- I ESTABLISH THE GLOBAL VARIABLE]

    aaa=10;

    recnum=1

     

    if( to_do == "EditEntry" )

    { //33

    Response.Write( “before”+ recnum +") datamessage = ["+ datamessage +"] <br>" ); [<-- “global”]

    datamessage = "pppppppppppppppp";

    Recnum = 37;

    [ It apparently doesn't know there is a global variable by the same name, so it creates a new local variable, while the global one remains unchanged. String or integer, it doesn't matter. ]

    Response.Write( “after”+ recnum +") datamessage = ["+ datamessage +"] <br>" );

     <input type=hidden name="to_do"   value= "WriteEntry">

    <input type=submit  value="Save">

    } //33

     

    if( to_do == "WriteEntry" )

    { //24B

    Response.Write( “WriteEntry ”+ recnum +") datamessage = ["+ datamessage +"] <br>" );

    [....global variables remain unchanged. Please, how can I fix this? .... ]

    } //24B

     

  13. 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 ";

    var rs = Server.CreateObject("ADODB.RecordSet");

    rs.Open (sql, ConnectionObject);

    fff = GetFieldToRead( databasename );

    ---------------------------------

    My program reads an *.mdb file----> SantaName = rs("man1").Value

    But it changes every month - February= rs("man2").Value,  march= rs("man3").Value, and so forth. I could and have used if-statements, but I want to learn how to build or customize that command. Would it be like you build a string? - = "rs(/""+ fff +"/").Value)", where fff signifies man1 or man2 or man3, etc. Just point me in the right direction and I'll study it.

  14. I can't copy and paste to this window, and i'm terrible typist, so this link holds the major text. I need to know code to open *.accdb formatted file.

    ccs2468.com/santa/aspquestion.txt

  15. See site: ccs2468.com/santa/aspquestion.txt

     

    I need you to show me how to open a data file for the *.accdb file format. Here's how I do it for *.mdb (2003) format - .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 table1"; var rs = Server.CreateObject("ADODB.RecordSet");  rs.Open (sql, ConnectionObject); .For years I used Access2010 to create and edit files used by my ASP scripts; everything was in the *.mdb (2003) format. Now I have Access2013, and it creates files in the *.accdb format - that my scripts can't read. Sure, I can reformat the file into the old format, but that's sort of like devolution.
  16. the <form> element's method, please elaborate. <input type=text> automatically passes. To manually pass you use < type=hidden>, Is there a type=no hidden?

     

    i don't see where I can attach a file. So I have uploaded a snippet of my code to my website that might help to clarify my question - ccs2468.com/santa/aspquestion.txt

×
×
  • Create New...