SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    Dec 2009
    Posts
    321
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Implementing Java for a slide show

    This seems to be the least offensive (code wise) for a simple slid show in a web page.

    All I get is a blank frame of the correct dimensions with a small red x in the corner.

    I think my problem might be that I don't know how to implement java into this script.

    I have C:\Java\jdk.1.7.0\jre6\jre7.

    This is from : http://www.javascriptkit.com/howto/show2.shtml

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" />
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="Content-Language" content="en"/>
    <meta name="keywords" content="orange county real estate, local broker, local real estate broker, local agent, local real estate agent, orange county real estate broker, orange county real estate agent." />
    <title>Properties With Style Home Page Orange County Real Estate</title> 
    <link type="text/css" rel="stylesheet" href="" media="screen,projection,tv"/>
    <script type="text/javascript">
    
    var image1=new Image()
    image1.src="c:\mydesign\css\images\bayfrontyard.jpg"
    var image2=new Image()
    image2.src="c:\mydesign\css\images\villagecolor.jpg"
    var image3=new Image()
    image3.src="c:\mydesign\css\images\villagestreetsdown.jpg"
    </script>
    </head>
    
    <body>
    <img align="right""" src="c\mydesign\css\images\bayfrontyard.jpg" name="slide" width="450" height="270" />
    <script>
    <!--
    //variable that will increment through the images
    var step=1
    function slideit(){
    //if browser does not support the image object, exit.
    if (!document.images)
    return
    document.images.slide.src=eval("image"+step+".src")
    if (step<3)
    step++
    else
    step=1
    //call function "slideit()" every 2.5 seconds
    setTimeout("slideit()",6000)
    }
    slideit()
    //-->
    </body>
    </html>
    Thanks . . . Rick

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,789
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    The script you have posted is JavaScript - not Java so where you have Java installed makes no difference to the script.

    All your imagereferences are invalid because \ is an escape character in JavaScript and so you need to specify them all as \\ if you want an actual \ - it is easier to use a / instead.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Addict
    Join Date
    Dec 2009
    Posts
    321
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Felgall - I believe we have crossed paths before.

    So I changed the hash marks to / as that IS easier but no effect.

    If I can just get this going then I can easily add more pictures later.

    Also - javascript does not need Java on the computer? How is it interpreted then?

    What do you suggest next?

    Rick

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,789
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Try changing all the \ to / and see if that fixes the problem.

    JavaScript is directly interpreted by the web browser - it is when you include java applets in the web page that the Java plugin is required.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  5. #5
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by R Schreiber View Post
    Also - javascript does not need Java on the computer? How is it interpreted then?
    That's a common misconception. JavaScript and Java are both completely different languages. The only similarity is in their names. Initially JavaScript was called Livescript, which was renamed due to politics to be JavaScript instead.

    You can read up about the history of JavaScript as written up by felgall over at http://javascript.about.com/od/reference/a/history.htm
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


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
  •