Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Senior Coder effpeetee's Avatar
    Join Date
    Feb 2007
    Location
    Clapham Junction - London SW
    Posts
    4,885
    Thanks
    228
    Thanked 204 Times in 203 Posts

    Exclamation How can I transfer a variable from HTML to Javascript program.

    http://www.exitfegs.co.uk/aaind.html


    If you go to the URL above, you will be in a page that is randomly selected using a javascript code. When this script was first written, I realised that I had not supplied a way out. I could have made the javascript to select an html page, but I already have over two hundred such pages on my site and I do not want to add to them.

    Just by trial and error, I found that putting the hyperlink into the html, on to the image container, that it would then allow any image selected to return to the index page (by clicking) without putting the image on it's own html.

    I just wanted to find a way to do this using a selected thumbnail which would then provide the Jscript routine with the variable (i) and thus show the full size image plus related caption. Then I could redirect the hyperlink (nowset to the index) with a hyperlink to the thumbs selection page.

    REMEMBER - NO carrier html page to be used.

    Am I reaching for the Moon here?

    This was originally on the HTML/CSS page but on reflection, it should be here.

    Frank

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Random image display</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style type="text/css">
    
    body { background: #ffffff;
           color: #000000;}
    a:link { color: #ff0000; }
    a:visited { color: #0000cc; }
    a:active { color: #ffff00; }
    
    </style>
    <script type="text/javascript">
    
    function showImage(){
     var r_text = new Array();
            r_text[0] = "Steven relaxing on the Watercress Line.";
            r_text[1] = "The Museum of the Tolpuddle Martyrs, Dorchester, Dorset."; 
            r_text[2] = "An ornamental bridge at 'Mapperton' A stately home in Dorset.";
            r_text[3] = "The front view of 'Mapperton' A stately home in Dorset.";
            r_text[4] = "Higher Came Farm. Our holiday 'digs' on several occasions.";
            r_text[5] = "A formal garden at 'Mapperton' A stately home in Dorset.";
            r_text[6] = "A lawn at 'Mapperton' A stately home in Dorset.";
            r_text[7] = "A beautiful Japanese picture. Downloaded from the Internet.";
            r_text[8] = "A lovely country road.";
            r_text[9] = "In the grounds of 'Mapperton' in Dorset.";
            r_text[10] = "A bridge. Somewhere in Australia. Answers on a postcard please.";
            r_text[11] = "In the grounds of 'Mapperton' in Dorset.";
            r_text[12] = "Inside St.Nicholas' Church - Moreton. Laurence of Arabia is buried here.";
            r_text[13] = "The Bell Hotel at Alresford on the Watercress Line. ";
            r_text[14] = "Horsted Keynes Station.";
            r_text[15] = "Higher Came Farmhouse. Our holiday 'digs' on several occasions.";
            r_text[16] = "The sea front at Swanage.";
            r_text[17] = "Horsted Keynes Station.";
            r_text[18] = "Steven, Mum Taylor and Betty.";
            r_text[19] = "You should have turned left at the cross-roads.";
            r_text[20] = "Winchester Cathedral";      
            r_text[21] = "Road up! Weymouth, - 2005.";
            r_text[22] = "This way to 'Higher Came' farmhouse.";
            r_text[23] = "Topiary at Mapperton";
            r_text[24] = "Footsteps' Our lodging in the Welsh Marches. Very nice.";
            r_text[25] = "A lovely country road.";
            r_text[26] = "A view from the tower of Salisbury Cathedral.";
            r_text[27] = "Books Afloat, a favourite bookshop in Weymouth, Dorset.";
            r_text[28] = "Mark & Steven at the Museum of the Tolpuddle Martyrs, Dorchester, Dorset.";
            r_text[29] = "A view from the 'London Eye'. Courtesy of Desmond Anderson.";
            r_text[30] = "A pond at 'Mapperton' in Dorset.";
            r_text[31] = "A view from the 'Footsteps' guest house.";
            r_text[32] = "Devil's Bridge station.";
            r_text[33] = "On the Welsh Highland Railway at Waunfawr.";
            r_text[34] = "Messing about in boats!";
            r_text[35] = "Llanfair Railway Station.";
            r_text[36] = "Alresford Railway Station, on the Watercress line.";
            r_text[37] = "Horsted Keynes Station, on the Bluebell line."; 
            r_text[38] = "A very weedy stream at 'Mapperton'.";
            r_text[39] = "A beautiful Japanese picture. Downloaded from the Internet.";
            r_text[40] = "Alresford High Street.";
            r_text[41] = "The Brecon Mountain Railway Station.";
            r_text[42] = "Ah! But will you get an answer?";
            r_text[43] = "A Japanese landscape.";
            r_text[44] = "An Australian Gum Tree.";
            r_text[45] = "Ayres Rock Australia.";
            r_text[46] = "Duke Street Brighton, England. April 2006..";
            r_text[47] = "Duke Street Brighton,England. April 2006.";
            r_text[48] = "Sea Front, Brighton England. April 2006.";
            r_text[49] = "A Coffee house in Russia.";
            r_text[50] = "Aquila Heights Dorchester. May 2006";
            r_text[51] = "Sleepy koala.";
            r_text[52] = "The London Eye on the bank of the River Thames.";
            r_text[53] = "Stuck in the sand somewhere in Australia.";
            r_text[54] = "Bodo airdrome Norway.";
            r_text[55] = "Derwent Water. In the English 'Lake District'";
            r_text[56] = "Lake Locarno Switzerland.";
            r_text[57] = "Winchester High St - July 2006";
            r_text[58] = "An Asian street market";         
            r_text[59] = "Frank's office where it all begins.";
            r_text[60] = "A pleasant day out on the Bluebell Railway - Spring 2006.";
            r_text[61] = "The London Eye from afar.";
            r_text[62] = "The early morning Sun reflected from a glass fronted building.";
            r_text[63] = "Winchester High Street.";
            r_text[64] = "Dr Beeching has been here";
            r_text[65] = "A road in Japan.";
            r_text[66] = "It's a long road................in Australia";
            r_text[67] = "Where have all the people gone?.";
            r_text[68] = "Steve, some time in the past.";
            r_text[69] = "Steve, a few years ago.";
            r_text[70] = "A Family get together at the Harvester pub at Hemel Hempstead.";
            r_text[71] = "A street in Worthing - Autumn 2006.";
            r_text[72] = "A street in Worthing - Autumn 2006.";
            r_text[73] = "A street in Worthing - Autumn 2006.";
            r_text[74] = "The 'Prince of Wales' at Devil's Bridge - September 2006.";
            r_text[75] = "The Sea Front at Eastbourne - September 2006.";
            r_text[76] = "The Sea Front at Eastbourne - September 2006.";
            r_text[77] = "Bognor street market - September 2006.";
            r_text[78] = "O'Connell Bridge Dublin.";
            r_text[79] = "St.Albans market - October 2006";
            r_text[80] = "A street in Serbia.";
            r_text[81] = "Frank in a garden at Mapperly.";
            r_text[82] = "Photo taken near Queenstown, on the South Island of New Zealand.";
            r_text[83] = "Sweet Dreams Mum; Madge Taylor.";
            r_text[84] = "A Fjiord in Norway. Taken by Steve on holiday there."; 
            r_text[85] = "A Fjiord in Norway. Taken by Steve on holiday.";         
            r_text[86] = "Eastbourne sea front - September 2006."; 
            r_text[87] = "Many years ago.";         
            r_text[88] = "Frank in Mapperton Gardens.";
            r_text[89] = "On Tour - From the car window.";
            r_text[90] = "A street in Beijing.";
            r_text[91] = "Steven relaxing in Eastbourne - Sept. 2006.";
            r_text[92] = "Steven in Hove, April 2007.";
            r_text[93] = "Museum in Jaipur.";
            r_text[94] = "Just before the storm - Sept. 2006.";
            r_text[95] = "Maremma_on_the_road_Italy.";
            r_text[96] = "Mevagissey shops.";
            r_text[97] = "At a cross-roads - somewhere in Australia..";
            r_text[98] = "We're only here for the beer.";
            r_text[99] = "Summit of Liatach, Torridon, Highland. Taken by Steve on holiday.";
            r_text[100] = "The Cuillins. Taken by Steve on holiday.";
            r_text[101] = "A Norwegian Fjiord. Taken by Steve on holiday."
            r_text[102] = "Frank's keyboard.";
            r_text[103] = "Eddie King. A family friend";
            r_text[104] = "Smile please!";
            r_text[105] = "George Street,Hove. April 2007.";
            r_text[106] = "The Magic Cafe Oxford, England.";
            r_text[107] = "Ali fan bazaar-Tehran ";
    
     
            setTimeout("location.reload(true)", 45000);  
    var i = Math.round((r_text.length-1)*Math.random());
    document.getElementById('caption_container').innerHTML=r_text[i];
    var img_rnd = new Array ("Steve6.jpg", "1.jpg", "2.jpg", "3.jpg", "4.jpg", "5.jpg", "6.jpg", "7.jpg", "8.jpg", "9.jpg", "10.jpg", "11.jpg", "12.jpg", "13.jpg", "14.jpg", "15.jpg", "16.jpg", "17.jpg", "18.jpg", "19.jpg", "20.jpg", "21.jpg", "22.jpg", "23.jpg", "24.jpg", "25.jpg", "26.jpg", "27.jpg", "28.jpg", "29.jpg", "30.jpg", "31.jpg", "32.jpg", "33.jpg", "34.jpg", "35.jpg", "36.jpg", "37.jpg", "38.jpg", "39.jpg", "40.jpg", "41.jpg", "42.jpg", "43.jpg", "44.jpg", "45.jpg", "46.jpg", "47.jpg", "48.jpg", "49.jpg", "50.jpg", "51.jpg", "52.jpg", "53.jpg", "54.jpg", "55.jpg", "56.jpg", "57.jpg", "58.jpg", "59.jpg", "60.jpg", "61.jpg", "62.jpg", "63.jpg", "64.jpg", "65.jpg", "66.jpg", "67.jpg", "68.jpg", "69.jpg", "70.jpg", "71.jpg", "72.jpg", "73.jpg", "74.jpg", "75.jpg", "76.jpg", "77.jpg", "78.jpg", "79.jpg", "80.jpg", "81.jpg", "82.jpg", "83.jpg", "84.jpg", "86.jpg", "87.jpg", "88.jpg", "dadingardens.jpg", "carwindow.jpg", "Beijing.jpg", "93.jpg", "Hove1.jpg", "95.jpg", "96.jpg", "97.jpg", "mevagissey-shops.jpg", "106.jpg", "100.jpg", "101.jpg", "img090.jpg", "img163.jpg", "102.jpg", "107.jpg", "smileplease.jpg", "Hove2007.jpg", "108.jpg", "109.jpg");
      
    document.getElementById('image_holder').innerHTML='<IMG alt="Use full screenF11. Click for Home Page" SRC="' + img_rnd[i] + '"style="Z-INDEX: 100; LEFT: 0px; WIDTH: 1024px; POSITION: absolute; TOP: -12px; HEIGHT:768px" height=800 >';
    }
    window.onload=showImage;
    
    </script>
    </head>
    <body>
    
    
    <a href="index.html"><div id="image_holder"></div>
    <span id="caption_container" 
        style="position:absolute;
        {padding: 2px 8px}    
            border-style: solid;
               border-width: thin;
                border-color: #ffffff;
                    border-width: 1px;                 
                        margin-top: 7px;                     
                    margin-left:20px;
                 z-index:1000;
               font-size: 20px;
            color: #ffffff; 
        background-color: gray;">
    </span></a>
    
    </body>
    </html>
    Last edited by effpeetee; 09-03-2007 at 12:09 PM. Reason: altering the title.
    * Sources (updated: 21.11.2012.
    Using Windows 8 Professional. 64bit with HP Photosmart 5510 printer Very useful site here.

  • #2
    Senior Coder effpeetee's Avatar
    Join Date
    Feb 2007
    Location
    Clapham Junction - London SW
    Posts
    4,885
    Thanks
    228
    Thanked 204 Times in 203 Posts

    Exclamation How can I transfer a number from html to a javascript

    I want to select a number in an HTML page and transfer it as an input to use in a javascript. How can I do this please.

    Any help gratefully received.

    Frank
    Last edited by effpeetee; 09-03-2007 at 10:24 AM.
    * Sources (updated: 21.11.2012.
    Using Windows 8 Professional. 64bit with HP Photosmart 5510 printer Very useful site here.

  • #3
    Regular Coder
    Join Date
    Jun 2004
    Posts
    495
    Thanks
    0
    Thanked 82 Times in 80 Posts
    Give a html code snippet indicating where the number is located.

  • #4
    Senior Coder effpeetee's Avatar
    Join Date
    Feb 2007
    Location
    Clapham Junction - London SW
    Posts
    4,885
    Thanks
    228
    Thanked 204 Times in 203 Posts
    Quote Originally Posted by Fang View Post
    Give a html code snippet indicating where the number is located.
    I am sorry, but I do not understand what you say.

    Frank
    * Sources (updated: 21.11.2012.
    Using Windows 8 Professional. 64bit with HP Photosmart 5510 printer Very useful site here.

  • #5
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Quote Originally Posted by effpeetee View Post
    I am sorry, but I do not understand what you say.

    Frank
    Nor do we about what you need. What do you mean by "select" a number on a HTML page? On using a mouse's select? And what do you mean by "transfer"? You want to fill (autofill) a text field with that value? And which could be your event (following which action of the user) ?
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #6
    Regular Coder
    Join Date
    Jun 2004
    Posts
    495
    Thanks
    0
    Thanked 82 Times in 80 Posts
    Kor, it's related to this post. The threads should be merged (you're a Mod. here)

  • #7
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    ok, merged...
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #8
    Senior Coder effpeetee's Avatar
    Join Date
    Feb 2007
    Location
    Clapham Junction - London SW
    Posts
    4,885
    Thanks
    228
    Thanked 204 Times in 203 Posts
    Hello all,

    This program which I use for testing purposes, allows me to select the value of 'i' which the jscript uses. However, it does it from the script. I want to do the number selection externally, selecting from the html page which will have numbered thumbnail images on it. The number, at least initially, to be keyboard entered.

    Sorry for the confusion. I forgot that I had transfered from the HTML section.

    Frank


    Code:
     <!doctype html public "-//W3C//DTD html 4.0 Transitional//EN">  
    <html> 
    <LINK REL="stylesheet" TYPE="text/css" HREF="atwo.css">
    <HEAD>
    <TITLE>index</TITLE>
    t> 
    </HEAD> 
    <BODY> 
     <DIV style="Z-INDEX: 101; LEFT: 90px; WIDTH: 800px; POSITION: absolute; TOP: 65px; HEIGHT: 25px"><CENTER>
    <span class="t13aw"><strong>
    <script language="JavaScript">
      var i = prompt("Please enter number required ", "");
    i--
    
        
      
      
           var r_text = new Array (); 
      
            r_text[0] = " 1 - Steven relaxing on the Watercress Line.";
            r_text[1] = " 2 - The Museum of the Tolpuddle Martyrs, Dorchester, Dorset."; 
            r_text[2] = " 3 - An ornamental bridge at 'Mapperton' - a stately home in Dorset.";
            r_text[3] = " 4 - The front view of 'Mapperton' - A stately home in Dorset.";
            r_text[4] = " 5 - Higher Came Farm. Our holiday 'digs' on several occasions.";
            r_text[5] = " 6 - A formal garden at 'Mapperton' - A stately home in Dorset.";
            r_text[6] = " 7 - A lawn at 'Mapperton',a stately home in Dorset.";
            r_text[7] = " 8 - A beautiful Japanese picture. Downloaded from the Internet.";
            r_text[8] = " 9 - A lovely country road.";
            r_text[9] = "10 - In the grounds of 'Mapperton' in Dorset.";
            r_text[10] = "11 - A bridge. Somewhere in Australia. Answers on a postcard please.";
            r_text[11] = "12 - In the grounds of 'Mapperton' in Dorset.";
            r_text[12] = "13 - Inside St.Nicholas' Church - Moreton. Laurence of Arabia is buried here.";
            r_text[13] = "14 - The Bell Hotel at Alresford on the Watercress Line. ";
            r_text[14] = "15 - Horsted Keynes Station.";
            r_text[15] = "16 - Higher Came Farmhouse. Our holiday 'digs' on several occasions.";
            r_text[16] = "17 - The sea front at Swanage.";
            r_text[17] = "18 - Horsted Keynes Station.";
            r_text[18] = "19 - ";
            r_text[19] = "20 - You should have turned left at the cross-roads.";
            r_text[20] = "21 - Winchester Cathedral";      
            r_text[21] = "22 - Road up! - Weymouth, 2005.";
            r_text[22] = "23 - This way to 'Higher Came' farmhouse.";
            r_text[23] = "24 - Topiary at Mapperton";
            r_text[24] = "25 - 'Footsteps' - Our lodging in the Welsh Marches. Very nice.";
            r_text[25] = "26 - A lovely country road.";
            r_text[26] = "27 - A view from the tower of Salisbury Cathedral.";
            r_text[27] = "28 - Books Afloat, a favourite bookshop in Weymouth, Dorset.";
            r_text[28] = "29 - Mark & Steven at the Museum of the Tolpuddle Martyrs, Dorchester, Dorset.";
            r_text[29] = "30 - A view from the 'London Eye'. Courtesy of Desmond Anderson.";
            r_text[30] = "31 - A pond at 'Mapperton' in Dorset.";
            r_text[31] = "32 - A view from the 'Footsteps' guest house.";
            r_text[32] = "33 - Devil's Bridge station.";
            r_text[33] = "34 - On the Welsh Highland Railway at Llanfair..";
            r_text[34] = "35 - Messing about in boats!";
            r_text[35] = "36 - Llanfair Railway Station.";
            r_text[36] = "37 - Alresford Railway Station, on the Watercress line.";
            r_text[37] = "38 - Horsted Keynes Station, on the Bluebell line."; 
            r_text[38] = "39 - A very weedy stream at 'Mapperton'.";
            r_text[39] = "40 - A beautiful Japanese picture. Downloaded from the Internet.";
            r_text[40] = "41 - Alresford High Street.";
            r_text[41] = "42 - The Brecon Mountain Railway Station.";
            r_text[42] = "43 - A Japanese mother with her children.";
            r_text[43] = "44 - A Japanese landscape.";
            r_text[44] = "45 - An Australian Gum Tree.";
            r_text[45] = "46 - Ayres Rock - Australia.";
            r_text[46] = "47 - Duke Street - Brighton, England. April 2006..";
            r_text[47] = "48 - Duke Street Brighton, - England. April 2006.";
            r_text[48] = "49 - Sea Front, Brighton - England. April 2006.";
            r_text[49] = "50";
            r_text[50] = "51 - Aquila Heights - Dorchester. May 2006";
            r_text[51] = "52 - Sleepy koala.";
            r_text[52] = "53 - The London Eye - on the bank of the River Thames.";
            r_text[53] = "54 - Stuck in the sand - somewhere in Australia.";
            r_text[54] = "55 - Bodo airdrome - Norway.";
            r_text[55] = "56 - Derwent Water. In the English 'Lake District'";
            r_text[56] = "57 - Lake Locarno - Switzerland.";
            r_text[57] = "58 - Winchester High St, - July 2006";
            r_text[58] = "59";         
            r_text[59] = "60 - The office where it all begins.";
            r_text[60] = "61 - A pleasant day out on the Bluebell Railway - Spring 2006.";
            r_text[61] = "62 - The London Eye.";
            r_text[62] = "63 - The early morning Sun reflected from a glass fronted building.";
            r_text[63] = "64 - Winchester High Street.";
            r_text[64] = "65";
            r_text[65] = "66 - A road in Japan.";
            r_text[66] = "67 - It's a long road................in Australia";
            r_text[67] = "68 - Where have all the people gone?.";
            r_text[68] = "69 - Steve, some time in the past.";
            r_text[69] = "70 - Steve, a few years ago.";
            r_text[70] = "71 - A Family get together at the Harvester pub at Hemel Hempstead.";
            r_text[71] = "72 - A street in Worthing - Autumn 2006.";
            r_text[72] = "73 - A street in Worthing - Autumn 2006.";
            r_text[73] = "74 - A street in Worthing - Autumn 2006.";
            r_text[74] = "75 - The 'Prince of Wales' at Devil's Bridge - September 2006.";
            r_text[75] = "76 - The Sea Front at Eastbourne - September 2006.";
            r_text[76] = "77 - The Sea Front at Eastbourne - September 2006.";
            r_text[77] = "78 - Bognor street market - September 2006.";
            r_text[78] = "79 - O'Connell Bridge - Dublin.";
            r_text[79] = "80 - St.Albans market - October 2006";
            r_text[80] = "81 - A street in Serbia.";
            r_text[81] = "82 - Frank in a garden at Mapperly.";
            r_text[82] = "83 - Photo taken near Queenstown, on the South Island of New Zealand.";
            r_text[83] = "84 - Sweet Dreams - Mum; Madge Taylor.";
            r_text[84] = "85 - A Fjiord in Norway. Taken by Steve on holiday there."; 
            r_text[85] = "86 - Kingston station - New Zealand - South island.";         
            r_text[86] = "87 - Home sweet Home. Quite a few years ago."; 
            r_text[87] = "88 - The sea front at Worthing - September 2006.";         
            r_text[88] = "89 - Frank in Mapperton Gardens.";
            r_text[89] = "90 - On Tour - From the car window.";
            r_text[90] = "91 - A street in Beijing.";
            r_text[91] = "92 - Steven relaxing in Eastbourne - Sept. 2006.";
            r_text[92] = "93 - Enjoying the sun.";
            r_text[93] = "94 - Museum in Jaipur.";
            r_text[94] = "95 - Just before the storm - Clapham Junction - Sept. 2006.";
            r_text[95] = "96 - Maremma_on_the_road_Italy.";
            r_text[96] = "97 - Mevagissey shops.";
            r_text[97] = "98 - At a cross-roads - somewhere in Australia..";
            r_text[98] = "99 - We're only here for the beer.";
            r_text[99] = "100 - Lietach - Torridon.";
            r_text[99] = "100 - Summit of Liatach, Torridon, Highland. Taken by Steve on holiday.";
            r_text[100] = "101 - The Cuillins. Taken by Steve on holiday.";
            r_text[101] = "102 - A Norwegian Fjiord. Taken by Steve on holiday."
            r_text[102] = "103 - Frank's keyboard.";
            r_text[103] = "104 - Eddie King. A family friend";
    102
    
    
    
           
    
    
    
                    
            var r_hyperlink = new Array();
            
            r_hyperlink[0] = "1.html";
            r_hyperlink[1] = "2.html";
            r_hyperlink[2] = "3.html";
            r_hyperlink[3] = "4.html";
            r_hyperlink[4] = "5.html";
            r_hyperlink[5] = "6.html";
            r_hyperlink[6] = "7.html";
            r_hyperlink[7] = "8.html";
            r_hyperlink[8] = "9.html";
            r_hyperlink[9] = "10.html";
            r_hyperlink[10] = "11.html";
            r_hyperlink[11] = "12.html";
            r_hyperlink[12] = "13.html";
            r_hyperlink[13] = "14.html";
            r_hyperlink[14] = "15.html";
            r_hyperlink[15] = "16.html";
            r_hyperlink[16] = "17.html";
            r_hyperlink[17] = "18.html";
            r_hyperlink[18] = "19.html";
            r_hyperlink[19] = "20.html";
            r_hyperlink[20] = "21.html";
            r_hyperlink[21] = "22.html";
            r_hyperlink[22] = "23.html";
            r_hyperlink[23] = "24.html";
            r_hyperlink[24] = "25.html";
            r_hyperlink[25] = "26.html";
            r_hyperlink[26] = "27.html";
            r_hyperlink[27] = "28.html";
            r_hyperlink[28] = "29.html";
            r_hyperlink[29] = "30.html";
    
            r_hyperlink[30] = "31.html";
            r_hyperlink[31] = "32.html";
            r_hyperlink[32] = "33.html";
            r_hyperlink[33] = "34.html";
            r_hyperlink[34] = "35.html";
            r_hyperlink[35] = "36.html";
            r_hyperlink[36] = "37.html";
            r_hyperlink[37] = "38.html";
            r_hyperlink[38] = "39.html";
            r_hyperlink[39] = "40.html";
            r_hyperlink[40] = "41.html";
    
            r_hyperlink[41] = "42.html";
            r_hyperlink[42] = "43.html";
            r_hyperlink[43] = "44.html";
            r_hyperlink[44] = "45.html";
            r_hyperlink[45] = "46.html";
            r_hyperlink[46] = "47.html";
            r_hyperlink[47] = "48.html";
            r_hyperlink[48] = "49.html";
            r_hyperlink[49] = "50.html";
            r_hyperlink[50] = "51.html";
            r_hyperlink[51] = "52.html";
            r_hyperlink[52] = "53.html";
            r_hyperlink[53] = "54.html";
            r_hyperlink[54] = "55.html";
            r_hyperlink[55] = "56.html";
            r_hyperlink[56] = "57.html";
            r_hyperlink[57] = "58.html";
            r_hyperlink[58] = "59.html";
            r_hyperlink[59] = "60.html";        
            r_hyperlink[60] = "61.html";
            r_hyperlink[61] = "62.html";
            r_hyperlink[62] = "63.html";
            r_hyperlink[63] = "64.html";
            r_hyperlink[64] = "65.html";
            r_hyperlink[65] = "66.html";
            r_hyperlink[66] = "67.html";
            r_hyperlink[67] = "68.html";
            r_hyperlink[68] = "69.html";
            r_hyperlink[69] = "70.html";
            r_hyperlink[70] = "71.html";
            r_hyperlink[71] = "72.html";
            r_hyperlink[72] = "73.html";
            r_hyperlink[73] = "74.html";
            r_hyperlink[74] = "75.html";
            r_hyperlink[75] = "76.html";
            r_hyperlink[76] = "77.html";
            r_hyperlink[77] = "78.html";
            r_hyperlink[78] = "79.html";
            r_hyperlink[79] = "80.html";
            r_hyperlink[80] = "81.html";
            r_hyperlink[81] = "82.html";
            r_hyperlink[82] = "83.html";
            r_hyperlink[83] = "84.html";
            r_hyperlink[84] = "85.html";
            r_hyperlink[85] = "86.html";
            r_hyperlink[86] = "87.html";
            r_hyperlink[87] = "88.html";
            r_hyperlink[88] = "89.html";
            r_hyperlink[89] = "90.html";
            r_hyperlink[90] = "91.html";
            r_hyperlink[91] = "92.html";
            r_hyperlink[92] = "93.html";
            r_hyperlink[93] = "94.html";
            r_hyperlink[94] = "95.html";
            r_hyperlink[95] = "96.html";
            r_hyperlink[96] = "97.html";
            r_hyperlink[97] = "98.html";
            r_hyperlink[98] = "99.html";
            r_hyperlink[99] = "100.html";
            r_hyperlink[100] = "101.html";
            r_hyperlink[101] = "102.html";
            r_hyperlink[102] = "103.html"
            r_hyperlink[103] = "104.html";;  
     
            
      document.write (r_text[i]); var img_rnd = new Array ("steve6.jpg", "1.jpg", "2.jpg", "3.jpg", "4.jpg", "5.jpg", "6.jpg", "7.jpg", "8.jpg", "9.jpg", "10.jpg", "11.jpg", "12.jpg", "13.jpg", "14.jpg", "15.jpg", "16.jpg", "17.jpg", "18.jpg", "19.jpg", "20.jpg", "21.jpg", "22.jpg", "23.jpg", "24.jpg", "25.jpg", "26.jpg", "27.jpg", "28.jpg", "29.jpg", "30.jpg", "31.jpg", "32.jpg", "33.jpg", "34.jpg", "35.jpg", "36.jpg", "37.jpg", "38.jpg", "39.jpg", "40.jpg", "41.jpg", "42.jpg", "43.jpg", "44.jpg", "45.jpg", "46.jpg", "47.jpg", "48.jpg", "49.jpg", "50.jpg", "51.jpg", "52.jpg", "53.jpg", "54.jpg", "55.jpg", "56.jpg", "57.jpg", "58.jpg", "59.jpg", "60.jpg", "61.jpg", "62.jpg", "63.jpg", "64.jpg", "65.jpg", "66.jpg", "67.jpg", "68.jpg", "69.jpg", "70.jpg", "71.jpg", "72.jpg", "73.jpg", "74.jpg", "75.jpg", "76.jpg", "77.jpg", "78.jpg", "79.jpg", "80.jpg", "81.jpg", "82.jpg", "83.jpg", "84.jpg", "86.jpg", "87.jpg", "88.jpg", "dadingardens.jpg", "carwindow.jpg", "Beijing.jpg", "93.jpg", "94a.jpg", "95.jpg", "96.jpg", "97.jpg", "mevagissey-shops.jpg", "106.jpg", "100.jpg", "101.jpg", "img090.jpg", "img163.jpg", "102.jpg", "107.jpg");
            document.write('<a href="' + r_hyperlink[i] + '"><IMG SRC="' + img_rnd[i] +'"alt="Click to enlarge"style="Z-INDEX: 100; LEFT: 135px;WIDTH: 760px; POSITION: absolute; TOP:120px; HEIGHT: 570px" height=600 ></a>'); //--> 
      
     </SCRIPT>  </strong></SPAN></CENTER>
     </DIV>   
           
      
      
    </BODY>   
      
    </html>
    Last edited by effpeetee; 09-03-2007 at 12:05 PM.
    * Sources (updated: 21.11.2012.
    Using Windows 8 Professional. 64bit with HP Photosmart 5510 printer Very useful site here.

  • #9
    Senior Coder effpeetee's Avatar
    Join Date
    Feb 2007
    Location
    Clapham Junction - London SW
    Posts
    4,885
    Thanks
    228
    Thanked 204 Times in 203 Posts
    Quote Originally Posted by Kor View Post
    ok, merged...
    If any one is looking.

    The title which has been transfered is now not appropriate.

    I suggest-

    Frank

    Really sorry for the Taylor made mess-up.

    How can I transfer a variable from HTML to Javascript program.
    * Sources (updated: 21.11.2012.
    Using Windows 8 Professional. 64bit with HP Photosmart 5510 printer Very useful site here.

  • #10
    Regular Coder
    Join Date
    Jun 2004
    Posts
    495
    Thanks
    0
    Thanked 82 Times in 80 Posts
    Quote Originally Posted by effpeetee View Post

    How can I transfer a variable from HTML to Javascript program.
    Show us where the variable is in the HTML

  • #11
    Senior Coder effpeetee's Avatar
    Join Date
    Feb 2007
    Location
    Clapham Junction - London SW
    Posts
    4,885
    Thanks
    228
    Thanked 204 Times in 203 Posts
    It isn't there yet. I haven;t written the HTML. At this stage I am fumbling I'm afraid.

    Frank
    * Sources (updated: 21.11.2012.
    Using Windows 8 Professional. 64bit with HP Photosmart 5510 printer Very useful site here.

  • #12
    Regular Coder
    Join Date
    Jun 2004
    Posts
    495
    Thanks
    0
    Thanked 82 Times in 80 Posts
    You can strip out any value from an attribute in any tag using DOM methods.
    The HTML has to be written first.

  • #13
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,534
    Thanks
    3
    Thanked 512 Times in 499 Posts
    Not sure I'm understanding but

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    <script language="JavaScript" type="text/javascript">
    /*<![CDATA[*/
    
    function LoadPic(nu){
     window.top.location='070903D.htm?'+nu;
    }
    /*]]>*/
    </script></head>
    
    <body>
    <div onclick="LoadPic('0');" >Load Pic 0</div>
    <div onclick="LoadPic('1');" >Load Pic 1</div>
    <div onclick="LoadPic('2');" >Load Pic 2</div>
    </body>
    
    </html>

    070903D.htm
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    <script language="JavaScript" type="text/javascript">
    /*<![CDATA[*/
    var zxcImagePath='http://www.vicsjavascripts.org.uk/StdImages/';
    var zxcAry=[];
    //       text         ,image                  ,URL
    zxcAry[0]=['My Text Zero',zxcImagePath+'Zero.gif','http://www.vicsjavascripts.org.uk/'];
    zxcAry[1]=['My Text One',zxcImagePath+'One.gif','http://www.vicsjavascripts.org.uk/'];
    zxcAry[2]=['My Text Two',zxcImagePath+'Two.gif','http://www.vicsjavascripts.org.uk/'];
    
    function Init(){
     var loc=window.location.toString().split('?');
     if (loc.length>1){
      var index=parseInt(loc[1]);
      document.getElementById('text').innerHTML=zxcAry[index][0];
      document.getElementById('image').src=zxcAry[index][1];
      document.getElementById('link').href=zxcAry[index][2];
     }
    }
    /*]]>*/
    </script>
    </head>
    
    <body onload="Init();" >
    <div id="text" ></div>
    <a href="#" id="link" ><img id="image" src="http://www.vicsjavascripts.org.uk/StdImages/Blank.gif" width="100" height="100"  /></a>
    
    </body>
    
    </html>
    I have used a dimensioned array as it should be easier to manage.

    I have not used doc.write as it is depreciated and I hate it.

    Not sure what type of typed input you require so have used links to show the use of the '?' string
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/

  • #14
    Senior Coder effpeetee's Avatar
    Join Date
    Feb 2007
    Location
    Clapham Junction - London SW
    Posts
    4,885
    Thanks
    228
    Thanked 204 Times in 203 Posts
    This is a rough idea of what I want to produce as an input page.

    also available at-

    http://www.exitfegs.co.uk/aatestaa.html

    Code:
     margin-top: 0px;        
     }	 
     .wrapper a { 	
     text-decoration: none;         
     color: #000;  } 
      </style>
    </head>
    
    <body>
    
    
      <div class="wrapper">
        <p><span><img src="81a.jpg" alt=" " width="100" height="80" /><br />
        1.Just a stranger in Paradise?</a></span></p>
    
        <p><span><img src="82a.jpg" alt="" width="100" height="80" /><br />
        2.South Island of NZ - Kingston Stn.</a></span></p>
    
        <p><span><img src="83a.jpg" alt="" width="100" height="80" /><br />
        3.Frank's mum - Madge Taylor .</a></span></p>
    
        <p><span><img src="84a.jpg" alt="" width="100" height="80" /><br />
        4.South Island of NZ - Kingston Stn.</a></span></p>
    
        <p><span><img src="85a.jpg" alt=""
        width="100" height="80" /><br />
        5.Resting at Aquila Heights - 2007.</a></span></p>
    
        <p><span><img src="86a.jpg" alt=" " width="100" height="80" /><br />
        6.A Fjiord in Norway.</a></span></p>
        <br><br>
        <p><Please select number.></p> - How do I input a keyboard number meaningfully here?
    
    </body>
    </html>
    * Sources (updated: 21.11.2012.
    Using Windows 8 Professional. 64bit with HP Photosmart 5510 printer Very useful site here.

  • #15
    Regular Coder
    Join Date
    Jun 2004
    Posts
    495
    Thanks
    0
    Thanked 82 Times in 80 Posts
    and the value(s) you want from HTML?

    Please validate your document.


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •