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 8 of 8
  1. #1
    New Coder
    Join Date
    Nov 2003
    Location
    San Francisco
    Posts
    45
    Thanks
    2
    Thanked 2 Times in 2 Posts

    Macintosh JS & Acrobat Problem

    We have a catalog of the products we sell online as a collection of PDF files. The files may be accessed individually or there is the option of going directly to any catalog page by using a little js utility.

    The utility is your typical input text box & button combo. Typing in a valid page number in the text box and clicking the button opens a new window with a PDF turned to the requested page, and works on the most common browsers/ OS combinations.

    Here's the prob: We decided to make it so the ENTER key would activate the script. Works fine in Windows, but on Mac with Safari nada! What these users get is the correct PDF turned to page one. I've tried a few variations of the key capture code to no avail.
    At present I am clueless though my intuition suggests this may have something to do with Acrobat.

    Thoughts? Thanks! -cc

    Key capture snippet-

    function getKey(e){
    var unicode=e.keyCode? e.keyCode : e.charCode
    if(unicode==13){
    document.getElementById('fetchit').click()
    }
    }

    Links-

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    Code:
    function handleKeyPress(evt) {
      var keyCode = (window.event)?event.keyCode:evt.which;
      alert(keyCode);
      return true;
    }
    document.onkeydown= handleKeyPress
    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    New Coder
    Join Date
    Nov 2003
    Location
    San Francisco
    Posts
    45
    Thanks
    2
    Thanked 2 Times in 2 Posts

    thanks!

    Thanks for your reply. Sorry to be late getting back to you but I can only work on this once a week. In any case am trying your code with a little variation, thus:
    Code:
    function handleKeyPress(evt) {
    var keyCode = (window.event)?event.keyCode:evt.which;
    if(keyCode==13){
    document.getElementById('fetchit').click()
    }
    }
    document.onkeydown= handleKeyPress
    We tried your solution, but I'm afraid it did not work. Seems this is a stickier prob than it seemed.
    CC
    Last edited by ccemmett; 01-12-2007 at 05:08 PM.

  • #4
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    function handleKeyPress(evt) {
    var keyCode = (window.event)?event.keyCode:evt.which;
    if(keyCode==13){
    document.getElementById('fetchit').click()
    }
    }
    document.onkeydown= handleKeyPress
    what if you called your onClick function if keyCode==13?
    if(keyCode==13){
    pageFetch();
    }

  • #5
    New Coder
    Join Date
    Nov 2003
    Location
    San Francisco
    Posts
    45
    Thanks
    2
    Thanked 2 Times in 2 Posts
    Afraid that's the original version that didn't work many versions ago.
    Hmmm, maybe I ought to post this on an Acrobat board.

    CC

  • #6
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I am sorry, you would probably need to pass the the "page number" to your pageFetch() function.

    name your form something ie pageForm and your text input box name; ie pageInput

    pageFetch(document.pageForm.pageInput.value)

    your pnum variable in pageFetch can be set to the value you pass it.
    Last edited by txaggie00; 01-12-2007 at 07:01 PM.

  • #7
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I just read through your code a bit.

    Shouldn't your donKeyDown be onKeyDown?

  • #8
    New Coder
    Join Date
    Nov 2003
    Location
    San Francisco
    Posts
    45
    Thanks
    2
    Thanked 2 Times in 2 Posts
    The pageFetch() function automatically snatches the text and because the code uses the event listener document.onkeydown= handleKeyPress to detect the keydown event I disabled the keydown event in the input box.

    Thanks for you help btw. I have an idea I'm going to try this weekend. Trouble is I don't have a Mac so I can't test the code directly. More soon.


  •  

    Posting Permissions

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