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 12 of 12
  1. #1
    New Coder
    Join Date
    Jan 2003
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    document.title in same window.

    Some time ago glenngv helped me with the following scripts:

    PageA.html à “copy and paste” or “reproduce” the (document.title) on another page (when this opens in a new window).

    PageB.html à e-mailgenerator that puts the “copied document.title” in the subject-line of the e-mail.

    Hereby the code:
    PageA.html
    <script>
    function doOpen(url, target){
    var w = window.open(url,target);
    w.document.title = document.title;
    w.focus();
    return false;
    }-->
    </script>
    ...
    <a href="B.html" target="_blank" onclick="return doOpen(this.href, this.target)">TextOrImageThatLinksToB.html</a>



    PageB.html (opens in a new window)

    <html>
    <head>
    <title>TITLE TEST (this is ‘+t+’ )</title>
    <script>
    <!--
    function changeMailto(i){
    i = escape(i);
    t = document.title;
    mailtoString = '<a href="mailto:?subject='+i+' – '+t+' ( ) ">Generate E-MailWithThe documentTitleInTheSubjectline</a>';
    document.getElementById('test').innerHTML = mailtoString;
    }
    -->
    </script>
    </head>
    <body>
    <form>
    <select onchange="changeMailto(this.options[this.selectedIndex].value)">
    <option value="apples">apples</option>
    <option value="oranges">oranges</option>
    <option value="bananas">bananas</option>
    </select>
    </form>
    <br />
    <div name="email" id="test" align=”center”></div>
    </body>
    </html>
    I restyled the webpages and am working now with 2 frames (FrameLeft and FrameRight). FrameLeft contains the navigationmenu.
    If pageB.html (FrameRight) opens in the same window, glenngv mentioned something about a cookie or the persistent property window.name to retrieve the document.title Can somebody please help me with the script so that that pageB.html opens in the same window as pageA.html (=FrameRight) and copies the document.title of pageA.html in the script of pageB.html, so that the e-mailgenerator is still working?
    Thanks.
    Jef gees
    jefgees@westbrabant.net

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    This may be one way to do it.



    In your nav page

    <script>
    <!--
    page_title=""

    function temp(t){
    page_title=t
    }
    // -->
    </script>

    Then in all pages loaded into your right frame

    <script>
    function save_title(){
    parent.leftframe.temp(document.title)
    }

    function get_title(){
    last_title=parent.leftframe.page_title
    }
    </script>


    <BODY onload="get_title()" onunload="save_title()">

    See attachment for working example
    Attached Files Attached Files

  • #3
    New Coder
    Join Date
    Jan 2003
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks already Mr J for trying to give me a helping hand.
    I tried it … but it didn’t work.
    Maybe I didn’t explain it the right way.

    I am working with 2 frames (LeftFrame and RightFrame)
    The LeftFrame contains the navigationbar.
    From this navigationbar I can select page’s that appear in the RightFrame.
    Suppose I selected the item “orders” in the navigationbar (Leftframe)
    In this case a page appears in the Rightframe.
    Here I’m in the RightFrame.
    Now I have several options to select..
    Suppose I choose for “FRUIT”. When I click this item, a new page (=pageA.html) opens in the RightFrame.
    PageA.html
    <title>How many </title>
    On this page is a link to pageB.html.

    PageB.html (If possible should open in the same window=RightFrame)

    This page is going to generate an e-mail with in the subject-line the document title of page A + the selected item in pageB.html followed by a question mark.

    <html>
    <head>
    <title>HereShouldComeTheTitleOfPageA_InThisCaseHowmay (=this is ‘+t+’ in the mailtoString)</title>

    <script>
    <!--
    function changeMailto(i){
    i = escape(i);
    t = document.title;
    mailtoString = '<a href="mailto:?subject='+i+' – '+t+' ? ">Generate E-MailWithThe documentTitleInTheSubjectline</a>';
    document.getElementById('test').innerHTML = mailtoString;
    }
    -->
    </script>
    </head>
    <body>
    <form>
    <select onchange="changeMailto(this.options[this.selectedIndex].value)">
    <option value="apples">apples</option>
    <option value="oranges">oranges</option>
    <option value="bananas">bananas</option>
    </select>
    </form>
    <br />
    <div name="email" id="test" align=”center”></div>
    </body>
    </html>
    I hope you can help me. I tried already to put the content of what was supposed to be for the LeftFrame in the pages of the RightFrame. And content that was supposed for the RightFrame in the e-mailgeneratorPage. But I couldn(t get it work. So I hope you or someone else can help me. Thanks a lot.
    Jef gees
    jefgees@westbrabant.net

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Lets see if we are a bit nearer with this one
    Attached Files Attached Files

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    There are many ways to pass data from one page to another using javascript. Read this article.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #6
    New Coder
    Join Date
    Jan 2003
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Glenngv and Mr J,

    Thank you very much … but it isn’t working. I tried everything, but still no progress.

    Am I wrong but I think It has something to do with a template I’m using to generate the “A.html’ pages. (There are about 500 pages where there is a link tot the e-mailgenerator (=pageB). That’s where glennv helped me a lot.

    When I change the template and put the script in the head it is over. The link to the emailgenerator (= page B does not work anymore.). So I think it has to do with the template.

    Maybe it is easier to go back to the first script and try to close the page (=pageA) when I go to the emailgenerator (pageB). Is this possible?? I mean the moment I click the link on pageA.html (to go to the emailgenerator), page A should close. Is this possible or is it fiction??

    Sorry to bother you, but I would appreciate it very much if you could give me a helping hand
    Thanks.

    Jef gees
    jefgees@westbrabant.net

  • #7
    New Coder
    Join Date
    Jan 2003
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Glenngv and Mr J and or someone who can help me,

    Sorry, sorry, sorry …
    but I got it wrong.
    It is not pageA.html that has to close, but page B (= emailgenerator-page).
    Is this possible?? I mean the moment I click on the emailgenerator and start the e-mail-application page B should close. Is this possible or is it fiction??

    Sorry again but It is not that easy for me.
    Jef gees
    jefgees@westbrabant.net

  • #8
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Post a copy of your frameset and pageA, pageB etc

  • #9
    New Coder
    Join Date
    Jan 2003
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I hope you can do something with it. I skimmed the site but I left the most important part (=emailgenerator), because otherwise the file is becoming too huge. Got a message that the file was too big.

    Is it possible to close the emailgenerator-page the moment you go to your email-program?

    Looking forward and keeping my fingers crossed for a solution,

    Jef Gees
    jefgees@westbrabant.net
    Attached Files Attached Files

  • #10
    New Coder
    Join Date
    Jan 2003
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    here is another zip.file with the code you mentioned. (i noticed that with the previous version something goes wrong with the template).
    Attached Files Attached Files

  • #11
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Is this what you wanted?

    Code:
    function changeMailtoCOLL(i){
       i = escape(i);
       t = document.title;   
       mailtoString = '<a href="mailto:?subject='+i+' – '+t+' ( )" onclick="window.close()"><span class="labelr">&nbsp;@&nbsp;</a>'; 
       document.getElementById('test').innerHTML = mailtoString; 
    }
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #12
    New Coder
    Join Date
    Jan 2003
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, yes, yes!
    Thanks a lot Glenn and Mr J,
    You can make this look so simple!
    Thanks again.

    I noticed in the forum a topic named “Auto-selecting options based on continuous keystrokes”. I’ll try to integrate this with the e-mailgenerator. Let you know if I could make it.
    Thanks a lot.

    Jef Gees
    jef.gees@westbrabant.net


  •  

    Posting Permissions

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