Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Plano, Texas
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Asp Script from htm page onLoad()

    I have a software program that genrates .htm webpages. It will not allow me to change extension to .asp It creates e.g. 1000 pages named 1.htm,2.htm ... 1000.htm. The "Title" of each page is the word not number. e.g. <title>One</title>. etc.

    The software allows me to add includes and scripts in javascript for the header section. Nothing server side. I can not modify the <body> tag.

    I would like to send a CDONTS email when the page loads. I understand cdonts and have a Notice.asp page that sends the type of mail I want.

    I would like to add something like an OnLoad() Function (Not on Body Tag) that would say submit a form to action page Notice.asp then return to the .htm page.

    Say a surfer opens 1.htm the onload script in the header would submit to Notice.asp Notice.asp would send email then redirect to 1.htm. Seamlessly hopefully. Mailto: in javascript is not my preferred answer.

    I tried the onload submit form and in notice.asp I caputured the url of the referrer (1.htm) in a session variable and then redirected to that to get back.

    Is this the right approach, and how can I avoid getting into a loop on the return to 1.htm???

    Any suggestions or leads certainly appreciated.

    TIA
    JoeP

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,043
    Thanks
    0
    Thanked 251 Times in 247 Posts
    Code:
    window.onload = function(){
      var mail = new Image();
      mail.src = "Notice.asp?d=" + Date.parse(new Date()); //the date parameter is to enable the browser not to process the page from cache
    }
    That will send request to the server on the background.

  • #3
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You could also use Ajax to call/run the script in the background

    The example here is to include a HTML file into a DIV, but if you just have an email script then you can include it into a hidden element.
    http://www.dynamicdrive.com/dynamici...jaxcontent.htm

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Plano, Texas
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oh man! You made my day on this tip! Thank you. Next time you are in the Dallas area, a Cool Bud is on my tab!

    Thank you!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •