Announcement

Collapse
No announcement yet.

Javascript inside a fragment

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Javascript inside a fragment

    I know this has been posted on the V8 forum.

    http://community.actinic.com/showthread.php?t=38755

    But as I am working on V10 I thought I would post here.

    I have been trying to get this working on my site bit with little success.

    I have tried all above that is suggested and also as js file and again nothing.

    This is the code that is generated from the site.

    <script language="JavaScript">
    <!--

    function random_imglink(){
    var myimages=new Array()
    //specify random images below. You can have as many as you wish
    myimages[ 1 ]="img1.jpg"
    myimages[ 2 ]="img2.jpg"
    myimages[ 3 ]="img3.jpg"

    //specify corresponding links below
    var imagelinks=new Array()
    imagelinks[ 1 ]="http://www.url.com"
    imagelinks[ 2 ]="http://www.url.com"
    imagelinks[ 3 ]="http://www.url.net"

    var ry=Math.floor(Math.random()*myimages.length)

    if (ry==0)
    ry=1
    document.write('<a href='+'"'+imagelinks[ ry ]+'"'+'><img src="'+myimages[ ry ]+'" border=0></a>')
    }

    random_imglink()
    //-->
    </script>


    any help would be great.

    Thanks

    #2
    Saying "nothing" tells us nothing. URL? Error message? Etc?
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Doh!!

      Sorry Norman

      URL is www.mpressmedia.com

      I get no error, just does not display.

      Thanks

      Comment


        #4
        You are using this on the home page of your site. You'll need to manually upload the images (img1.jpg, img2.jpg, img3.jpg) to there.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          Norman thanks I have just done that and I can see the images on the home page, but they only change when I refresh the screen.

          Is there anything i need to add to the script that will make them change?

          Thanks

          Glen

          Comment


            #6
            That's what that bit of code does. It displays one random image on each page visit.

            You'll need a different bit of code if you want an automatic slideshow. Search the Forum. Also plenty can be located through Google but you'll need some skill to adapt them to work with Actinic.

            My Multi Product Images can do this. See last product on http://www.drillpine.biz/v8multiprod...tproducts.html - it also works on Fragments.
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment


              #7
              Thanks Norman

              The slideshow on the the bottom of your link is the kind of thing I need for my site.

              Glen

              Comment


                #8
                The slideshow on my Multi Product Images is a kind of side-effect. The add on is really intended to allow customers to see alternative images of a product by clicking a small icon.

                Since the code to swap a main image was there, I added in an optional timer so that it could be used for slideshows. This also gives the customer the capability of clicking one of the icons to stop the slideshow in case one of the big pictures is of particular interest.
                Norman - www.drillpine.biz
                Edinburgh, U K / Bitez, Turkey

                Comment

                Working...
                X