Results 1 to 2 of 2

Thread: Help change path to load images (hangman script)

  1. #1
    Join Date
    Oct 2016
    Posts
    1
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Help change path to load images (hangman script)

    Hi there,
    a dumb question with "eval" function. I found inside script "hangman II" this line:

    Code:
    wrong_guesses += 1;
    eval("document.hm.src=\"hm" + wrong_guesses + ".gif\"");
    That shows the gif images url-of-the-page-where-script-is-displayed/hm1.gif
    or
    url-of-the-page-where-script-is-displayed/hm2.gif
    or
    url-of-the-page-where-script-is-displayed/hm3.gif
    etc.

    If the script (js + images) is installed in another directory (on the same domain) how can I change that line to be something like
    url-of-directory-where-are-stored-js-and-images/hm1.gif
    or
    url-of-directory-where-are-stored-js-and-images/hm2.gif
    etc?

    Thank you in advance!

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    First of all eval is unnecessary. This is the same thing:

    Code:
    document.hm.src = 'hm' + wrong_guesses + '.gif';
    And if you want to change it to use a folder or path:

    Code:
    document.hm.src = 'url-of-directory-where-are-stored-js-and-images/hm' + wrong_guesses + '.gif';
    Last edited by jscheuer1; 10-08-2016 at 03:28 AM. Reason: add semicolons for completeness
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    robaldo (10-07-2016)

Similar Threads

  1. Looking for a script... images don't load until you scroll to them
    By evanmiller2007 in forum Looking for such a script or service
    Replies: 20
    Last Post: 11-23-2011, 08:19 AM
  2. Replies: 3
    Last Post: 08-27-2009, 10:20 PM
  3. AS3 load the path to FLV at runtime
    By jeaux in forum Flash
    Replies: 4
    Last Post: 10-03-2008, 04:16 AM
  4. Help With HV Menu and images path
    By carlosvi in forum Dynamic Drive scripts help
    Replies: 3
    Last Post: 02-21-2007, 03:08 PM
  5. Tab Content Script - change on load?
    By ak7861 in forum Dynamic Drive scripts help
    Replies: 8
    Last Post: 10-09-2006, 07:16 PM

Bookmarks

Posting Permissions

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