Results 1 to 3 of 3

Thread: /big1.JPG?'+newDate().getTime() need help please

  1. #1
    Join Date
    Sep 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default /big1.JPG?'+newDate().getTime() need help please

    Hello all,

    I'm new to javascript and new to this forum, and it would be nice if someone could help me.

    I have a small problem.



    Code:
    <a href="javascriptopBeeld('aanbieding/boeket/big1.JPG?'+newDate().getTime()','Boeket v/d Week')">
    It isn't working, can someone tell me what's wrong with this code?

    the function popBeeld is working though.


    Thanks a ton in advance

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Hmm...
    You could try
    <a href="#" onClick="PopBeeld(........)">

    Though, it might be the code after that. (And that would give you a # at the end of the url bar after clicking the link.)


    Ah, now I see it.

    In javascript, the way to add multiple parts together is the plus sign-- +.

    'something'+function()+variable+'stuff'.

    You need to replace the dots and/or runon parts with a +.

    +newDate().getTime()
    should be:
    +newDate()+getTime()+

    However, I'm not sure about the dot. I don't do JS too much, and I use php, which does use a dot to combine parts. I know JS uses a + instead, but it might try to add the outputs of the functions together, since both will be numbers.
    Just play with that and see if you can get it to work.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by nospoony
    <a href="javascript:&#112;opBeeld('aanbieding/boeket/big1.JPG?'+newDate().getTime()','Boeket v/d Week')">
    Have you considered that if scripting is disabled, that image will be inaccessible to the user?

    HTML Code:
    <a href="aanbieding/boeket/big1.JPG" onclick="popBeeld(this.href, 'Boeket v/d Week'); return false;">
    If you are trying to prevent caching by appending a number to the URL, first think if you really need to do that (caching is your friend - only disable it if absolutely necessary), and second, do it from the server.

    the function popBeeld is working though.
    Perhaps, though it still would have been nice to know what the arguments for that function mean. For example, if the second argument was the name for a new window, you'd have problems because any characters beyond letters, numbers, and underscores generally aren't well-received.

    Mike

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
  •