Coding problem

Discussion in 'Computer Information' started by Robert Baer, Aug 22, 2013.

  1. Robert Baer

    Robert Baer Guest

    The following code "works" in a strange way; see the comments for
    1) why is that document.write necessary for operation?
    2) why doesn't the altered variable "title" remain changed?
    3) i would like to change displayed page, based on map visits

    Help? Comments?

    <SCRIPT type="text/javascript">
    // <img id="page" src=title alt="Codatron page 1">
    // src="images/CodatronP1.png"
    var title="images/CodatronP1.png";
    var dir=-1;
    var num=3;
    function incrPage(dir,title)
    if (dir===-1)
    if (num===0) {num=7;}
    if (num===8) {num=1;}
    // above correct at page 7 being "previous" to page 1 (sequence 1,2,,7,1
    // *NOTE* the document.write MUST exist for the map visits to work ???
    // document.write("***"+title+"* *#");
    // above is wrong, with title equal to unchanged initial def

    // document.getElementById("page").innerHTML=title;

    <img src="ShuttleN.png" alt="Select" usemap="#PageSelect"
    <!-- visiting mapped areas give "###-1*" or "###1*" in new screen -->
    <map id="images/CodatronP5.png" name="PageSelect">
    <area shape="rect" alt="Minus" coords="65,0,135,35"
    src="N.PNG" onMouseover="incrPage(-1,id)" >
    <area shape="rect" alt="Plus" coords="590,0,668,35"
    src="P.PNG" onMouseover="incrPage(1,id)" >
    <area shape="default" nohref="nohref" alt="" >

    <!-- display page one; would like to change that based on map visits -->
    <div class=" container_24">
    <div class="wrapper">
    <img id="page" src="images/CodatronP1.png" alt="Page">
    Robert Baer, Aug 22, 2013
    1. Advertisements

  2. Robert Baer

    Paul Guest

    You need a Javascript programming group. And the two I looked
    at, the noise level is pretty high (lots of adverts for
    prescription drugs). It would be pretty difficult to get
    a hearing in a group like that.

    Maybe you can find the odd university course note on Javascript.

    Paul, Aug 22, 2013
    1. Advertisements

  3. Robert Baer

    Robert Baer Guest

    Thanks! That is a decent presentation and rather clear for what they
    Then there is the JavaScript online tutorial which seems to cover
    everything,with working examples.
    But both only cover basics and not a "package".
    Robert Baer, Aug 22, 2013
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.