Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   JavaScript and Client-Side Browser Scripting (http://www.programmingforums.org/forum23.html)
-   -   Dynamica links (http://www.programmingforums.org/showthread.php?t=12484)

paulchwd Feb 1st, 2007 9:19 PM

Dynamica links
 
Hello All,

I need the user to click on an image and when the click the on that image, a javaScript (or vbScript for that matter-- i dont care which language) function executes which sets the value of this link the idea being every click of the image increments a variable and then that variable is concatenated with a string of the page i want it to go to (the variable's contents will represent an ancore on a page )

code :

:

<html>
<head>
<script language=javaScript>
<!--

var details=0, numImgs=2, link;

function string details()
{

        while( details <= numImgs)
        {
          details++;
          link= "forsale.htm#"+details;
 
          return link;
        }


}

//-->
</script>
</head>
<body>

<a href="javascript: details()"><img src=test.jpg"></a>
</body>
</html>


Arevos Feb 2nd, 2007 5:05 AM

:

var currentIndex = 0, maxIndices= 2;

function nextLink() {
    if (currentIndex <= maxIndices)
        window.location = "forsale.htm#" + currentIndex++;
}


paulchwd Feb 2nd, 2007 10:45 AM

Thank a million. It worked. Im more of a java programmer then a javaScript programmer as you can see from my code. Again thanks


All times are GMT -5. The time now is 1:50 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC