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
    New to the CF scene
    Join Date
    Jul 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Internet Explorer Content from a JavaScript var to display on a separate page

    I currently have a vertical scroll with lots of content in it. The script reads from an external js file and scrolls the HTML that I have in the var.

    Example:

    var content='<b>My content is here</b>';

    That is the very first thing in the file and then the rest of the script is listed. The external js file is named scrolltext.js.

    I would like to have a separate page set up where either a form field or just a section on the page can read the content of the scroller and display it all at once. The purpose for this would be so the site users can see all of the content without having to wait for it to scroll through. I update the content a lot and this solution would be easier, if possible, than copying and pasting it to another page every time I update it.

    Can someone help me? Thanks a lot.

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    625
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <script language="javascript" type="text/javascript" src="external.js">
    </script>

    <script>
    <!--

    function getVar(){

    document.content = (data);
    var mWin = window.open("","","");
    mWin.document.open();
    mWin.document.writeln("<html>");
    mWin.document.writeln("<head>");
    mWin.document.writeln("<title>Page Source<\/title>");
    mWin.document.writeln("<\/head>");
    mWin.document.writeln("<body topmargin=\"10\" marginheight=\"10\" leftmargin=\"10\" marginwidth=\"10\">");
    mWin.document.writeln("<center>");
    mWin.document.writeln("<table border=\"0\" width=\"750\" valign=\"top\">");
    mWin.document.writeln("<tr>");
    mWin.document.writeln('<td width=\"750\" valign=\"top\"><div align=\"justify\">'+ document.content +'<\/div><\/td><\/tr><\/table>');
    mWin.document.writeln("<\/center>");
    mWin.document.writeln("<\/body>");
    mWin.document.writeln("<\/html>");
    mWin.document.close();
    }

    //-->
    </script>




    <form name="mForm">
    <input type="button" name="mbut" value="getVar" onClick="javascript:getVar();" />
    </form>

    Contents of external.js:

    var data = ("This is where my content goes...");


    http://www.ekigroup.com/javascript/getVar.html

    -james
    Last edited by jamescover; 07-15-2004 at 03:09 AM.
    "God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life. For God did not send his son into the world to condemn the world, but so that through him the world might be saved. "

  • #3
    New to the CF scene
    Join Date
    Jul 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    Thank you very much for your help. I just threw the script you gave me into the existing js file and everything seems to be working fine! Thanks again.

  • #4
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    625
    Thanks
    0
    Thanked 0 Times in 0 Posts
    "God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life. For God did not send his son into the world to condemn the world, but so that through him the world might be saved. "


  •  

    Posting Permissions

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