+ Reply to Thread
Results 1 to 3 of 3

Thread: Javascript simple problem

  1. #1
    gaptrast's Avatar
    gaptrast is offline x10 Sophmore gaptrast is an unknown quantity at this point
    Join Date
    Nov 2009
    Posts
    117

    Javascript simple problem

    Hello,

    I have a small problem; it will not work!!!

    heres my code:::
    Code:
    <head>
    <script type="text/javascript">
    function download() {
    var base_url="http://www.example.com/valum.php?";
    var qs="koke";
    var dl = document.getElementById( "dl" ) ;
    var total = "window.location='" + base_url + "'";
    dl.onclick = total;
    }
    </script>
    
    </head>
    <body>
    
    
    
    <img id="dl" onclick="download();"  src="kokkelimonke.jpg" />
    
    </body>

    When I click at the image nothing is happening... I should have been be redirected to http://www.example.com/valum.php?koke , but nothing is happening!!!!
    LOOK RIGHT
    LOOK DOWN
    Questions you never knew you wanted answered - http://Wonderabout.info
    [New site!] Collection of fun computer pranks! - http://thefakevirus.com

  2. #2
    lemon-tree's Avatar
    lemon-tree is offline x10 Minion lemon-tree has a spectacular aura about
    Join Date
    Nov 2007
    Posts
    1,420

    Re: Javascript simple problem

    Try this:
    Code:
    <head>
    <script type="text/javascript">
    function download(){
    var base_url = "http://www.example.com/valum.php?";
    var qs = "koke";
    window.location = base_url + qs;
    }
    </script>
    
    </head>
    <body>
    
    
    
    <img id="dl" onclick="download();"  src="kokkelimonke.jpg" />
    
    </body>
    I'm not entirely sure how you are intending to extend this, so I haven't simplified it as fully as it'll go.

  3. #3
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: Javascript simple problem

    Exactly what do you want it to do?

    Are you actually trying to change the onclick handler in download()?
    Nothing is always absolutely so.

+ Reply to Thread

Similar Threads

  1. CSS simple problem
    By Parsa44 in forum Programming Help
    Replies: 11
    Last Post: 01-28-2009, 12:46 PM
  2. Simple Javascript help
    By Teensweb in forum Programming Help
    Replies: 3
    Last Post: 08-11-2008, 12:56 AM
  3. javascript and external javascript files problem
    By delon in forum Programming Help
    Replies: 6
    Last Post: 04-27-2008, 12:41 AM
  4. Most likely simple problem
    By messageboy in forum Scripts & 3rd Party Apps
    Replies: 0
    Last Post: 09-22-2007, 07:00 AM
  5. Some nice-simple JavaScript effects !!
    By careerbridge in forum Scripts & 3rd Party Apps
    Replies: 1
    Last Post: 07-13-2006, 08:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers