Results 1 to 4 of 4

Thread: Why doesn't this work

  1. #1
    Join Date
    Feb 2014
    Location
    ky
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Why doesn't this work

    I dont know how to post this properly. I have written code for a long time, but am ne to javascript. Why doesn't this work?
    Code:
    </head>
      <body>
      <script type="text/javascript">
      var headSrc="http://www." 
      var pathName="megeddo.nightsplutonianshore.com/";
      var alienDoc="aliendoc01.gif"
      document.write(headSrc + pathName + alienDoc);
      </script>
      <img src=headSrc + pathName + alienDoc width="344" height="222" alt="ace" title="" />
      </body>

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Your question is unclear.
    Please provide more information, and be as specific as possible.
    • What do you want to accomplish?
    • What have you already tried?
    • What problems did you encounter?

    Please be sure that you have included all relevant code and/or a link to the page in question.
    You might also consider making a reduced test case using an online tool like jsfiddle

  3. #3
    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

    I agree that it's unclear what you're asking. But this might be the answer:

    Code:
    </head>
      <body>
      <script type="text/javascript">
      var headSrc="http://www." 
      var pathName="megeddo.nightsplutonianshore.com/";
      var alienDoc="aliendoc01.gif";
      document.write('<img src="' + headSrc + pathName + alienDoc + '" width="344" height="222" alt="ace" title="" />');
      </script>
      
      </body>
    - John
    ________________________

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

  4. #4
    Join Date
    Feb 2014
    Location
    ky
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default image source

    i have a lot of images with long src strings. i just wanted to put the bulk of this in a variable to simplify code

Similar Threads

  1. Why some of css doesn't work in IE?
    By auriaks in forum CSS
    Replies: 5
    Last Post: 02-25-2010, 08:49 PM
  2. Why Doesn't it Work?
    By ??? in forum JavaScript
    Replies: 3
    Last Post: 08-11-2007, 01:32 AM
  3. Why doesn't this work??
    By shachi in forum JavaScript
    Replies: 8
    Last Post: 01-06-2007, 03:07 PM
  4. Doesn't work in IE 5!
    By neilkw in forum CSS
    Replies: 7
    Last Post: 04-04-2006, 09:33 AM
  5. Top nav II bar doesn't work!!
    By Blackryder in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 04-26-2005, 06:48 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
  •