SitePoint Sponsor

User Tag List

Results 1 to 18 of 18

Hybrid View

  1. #1
    K, Dan K Dan_K's Avatar
    Join Date
    Jun 2001
    Location
    Perth - Western Australia
    Posts
    475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    testimonials with next and previous

    Hey all,

    I'm looking for a script that i can use to display testimonials. So it starts with testimonial one and if you click next it moves to the next testimonial and previous moves backwards through the list.

    Anyone got or know the location of a script like this?

    Thanks for everyones help in advance,

    -Dan
    -Daniel Kerton,
    Humor

  2. #2
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    here's a little program

    <script language="javascript">

    description=new Array
    description[0]="a big house"
    description[1]="a nice car"
    description[2]="a brown horse"
    thisdescription=0

    function up(upordown){
    thisdescription=thisdescription+upordown
    document.getElementById("showdescription").innerText=description[thisdescription]}

    </script>

    <span id="showdescription" name="showdescription">this is where it will appear</span>

    <p onclick=up(1)>up<br>
    <p onclick=up(-1)>down
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2002
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I coded up a version that works in any 4.0 browser since innerText only works in IE.

    http://travis.squidfingers.com/togglediv.html

    This script toggles the visibility of a div to run the slideshow, so the html content is not in an array. This should be easier the edit and update.
    travis

  4. #4
    K, Dan K Dan_K's Avatar
    Join Date
    Jun 2001
    Location
    Perth - Western Australia
    Posts
    475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey thanks alot guys, if you need any free design work done contact me.

    Thanks again,

    -Dan
    -Daniel Kerton,
    Humor

  5. #5
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    innerHTML??

    Does innerHTML work cross browser?
    Have tried it in my program and it works for IE, Google seems to point to sites that use it in NS, how about other browsers.

    Many thanks.
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  6. #6
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    innerHTML works LOADS better

    innerHTML works so much better, especially in a description array, which could be written like this....

    description[horse]="A Brown Horse<br>Want to see a picture of my horse click <a href=horse.html>here"

    if you used this method you would need to set an array of description titles and use this array for going through each description.

    titles=new Array("house","car","horse")

    The innerText didn't allow for the HTML tags to work, but this does.....but does it work cross browser??

    I hope so.........
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  7. #7
    K, Dan K Dan_K's Avatar
    Join Date
    Jun 2001
    Location
    Perth - Western Australia
    Posts
    475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Markdidj how can I make your script return to the first testimonial once it gets to the end ???
    -Daniel Kerton,
    Humor

  8. #8
    SitePoint Enthusiast
    Join Date
    Nov 2002
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    innerHTML does not work in Netscape 4, and getElementById only works in a 5.0 browser, if you care about supporting older browsers.
    Last edited by podlob; Nov 23, 2002 at 21:11.
    travis

  9. #9
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    fun with forms........

    put this in function

    descriptionCount=description.length-1
    if(thisdescription<0) thisdescription=descriptionCount
    if(thisdescription>descriptionCount) thisdescription=0

    try this way using a form.....its funny

    as you input the data in a form, send it to the innerHTML using onkeyup. you will be able to enter HTML into the form and it will create the 'page' automatically every time you depress a key, so long as the code is complete!!

    so you can type in the form.....
    <img src="anImage.gif"
    and after you've put the '>' to finish the line it puts the pic in......useful for those doing online website building programs!!!
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  10. #10
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    update your browser......

    Link To Info

    making tomorrows website?
    use todays programming!!
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  11. #11
    K, Dan K Dan_K's Avatar
    Join Date
    Jun 2001
    Location
    Perth - Western Australia
    Posts
    475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you make it so undefined dosen't appear ?
    -Daniel Kerton,
    Humor

  12. #12
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Must be first in function

    is it first in the function?
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  13. #13
    K, Dan K Dan_K's Avatar
    Join Date
    Jun 2001
    Location
    Perth - Western Australia
    Posts
    475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no,
    -Daniel Kerton,
    Humor

  14. #14
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    It has to be first

    It has to be first in the function.

    otherwise when thisdescription is less than 0 it wont change to 0 until after the innerHTML has done its thing.
    so thisdescription will equal -1, and there is no description[-1]
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  15. #15
    K, Dan K Dan_K's Avatar
    Join Date
    Jun 2001
    Location
    Perth - Western Australia
    Posts
    475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've moved it to first in the function but it still happens, any ideas?
    -Daniel Kerton,
    Humor

  16. #16
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    sorry, wrong place

    try after....

    thisdescription=thisdescription+upordown

    I hope that works 4 u
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  17. #17
    K, Dan K Dan_K's Avatar
    Join Date
    Jun 2001
    Location
    Perth - Western Australia
    Posts
    475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sweet it works! Thanks Markdidj, If you need some free design work let me know.

    Thanks again,

    -Daniel
    -Daniel Kerton,
    Humor

  18. #18
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Cheers Dan...

    Thanks, I enjoyed the research (first time I've used innerHTML) Looks like it can be fun....

    Enjoy...

    Mark
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if


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
  •