...

View Full Version : How can I transfer a variable from HTML to Javascript program.



effpeetee
09-02-2007, 07:14 PM
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


<!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>

effpeetee
09-03-2007, 09:22 AM
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

Fang
09-03-2007, 09:34 AM
Give a html code snippet indicating where the number is located.

effpeetee
09-03-2007, 10:06 AM
Give a html code snippet indicating where the number is located.
I am sorry, but I do not understand what you say.

Frank

Kor
09-03-2007, 10:27 AM
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) ?

Fang
09-03-2007, 10:35 AM
Kor, it's related to this post (http://www.codingforums.com/showthread.php?t=122826). The threads should be merged (you're a Mod. here)

Kor
09-03-2007, 10:44 AM
ok, merged...

effpeetee
09-03-2007, 10:51 AM
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




<!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>

effpeetee
09-03-2007, 10:57 AM
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.

Fang
09-03-2007, 11:00 AM
How can I transfer a variable from HTML to Javascript program.

Show us where the variable is in the HTML

effpeetee
09-03-2007, 11:05 AM
It isn't there yet. I haven;t written the HTML. At this stage I am fumbling I'm afraid.

Frank

Fang
09-03-2007, 11:18 AM
You can strip out any value from an attribute in any tag using DOM methods.
The HTML has to be written first.

vwphillips
09-03-2007, 11:39 AM
Not sure I'm understanding but




<!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

<!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

effpeetee
09-03-2007, 11:47 AM
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


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>

Fang
09-03-2007, 11:57 AM
and the value(s) you want from HTML?

Please validate (http://validator.w3.org/) your document.

effpeetee
09-03-2007, 12:10 PM
Numbers from 1 to 10 say.

I know that it is not validated. It is just a rough. I did not see any point in doing more until I understood what I was aiming for.

Thanks to everyone for their interest and instruction.
I will respond to all as I come to deal with them.

What I am trying to do is to go from a chosen thumbnail to the main image, with a click, which is easy. I do not want to use a HTML page to hold the image. Just the raw image itself. Also easy.

Now the interesting bit.

I need to click from the image back to the thumbnail page. Very easy using a carrier HTML. I want to do it from the JPG Image directly. I found out by trying, that it is possible to put the hyperlink on the container and thus clicking any displayed jpg, would then return to the selector page again. But it inputs inside the javascript. I need to have the input from inside a html page.

If I can arrange to select the image, either by inputting a number or by clicking the thumbnail which then supplied the number, I can them get rid of over two hundred HTML pages from my site. Quite a worthwhile venture and something to keep me from going potty from boredom in my old age. Also, at least to me, worthwhile.

Thank you all for putting up with me.

Frank

vwphillips
09-03-2007, 12:37 PM
would have thought that the image parent onclick was best but

<!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 LoadPicClick(nu){
nu=parseInt(nu);
if (nu<3&&nu){
window.top.location='070903D.htm?'+(nu-1);
}
}
/*]]>*/
</script></head>

<body>
<div onclick="LoadPicClick('0');" >Load Pic 0</div>
<div onclick="LoadPicClick('1');" >Load Pic 1</div>
<div onclick="LoadPicClick('2');" >Load Pic 2</div>
<div class="wrapper">
<p onclick="LoadPicClick('1');" ><span><img src="81a.jpg" alt=" " width="100" height="80" /><br />
1.Just a stranger in Paradise?</a></span></p>

<p onclick="LoadPicClick('2');" ><span><img src="82a.jpg" alt="" width="100" height="80" /><br />
2.South Island of NZ - Kingston Stn.</a></span></p>

<p onclick="LoadPicClick('3');" ><span><img src="83a.jpg" alt="" width="100" height="80" /><br />
3.Frank's mum - Madge Taylor .</a></span></p>

<br><br>
<input type="text" value="Input A Number" onfocus="this.value='';" onblur="LoadPicClick(this.value);" />
<br />
or
<br />
<input id="Go" type="text" value="Input A Number" onfocus="this.value='';" /><input type="button" name="" value="Go" onclick="LoadPicClick(document.getElementById('Go').value);"/>
<br />
</form>

</body>

</html>

effpeetee
09-03-2007, 12:53 PM
Hello everyone and thanks.

It seems to me that I cannot do what I want to do and that enough time has been spent on the quest.

Some things are out of reach and the trick is to recognise when any more is too much.
I think that this has reached the end of the search. The pot of gold still eludes me.

Very many thanks to all you kind experts.

Frank



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum