[thelist] javascript help please

Brent Clark bclark at eccotours.dyndns.org
Tue May 10 04:55:49 CDT 2005


Hi all

My deepest apologies for posting here, but im so stuck with Javascript
at the moment.

I have a index.html  file when on loading executes a javascript function
(random_mainpage() ). which reads the array (sarray) and displays in
content on the browser.

I to have a link that onclicking must execute (pframe(number)) with the
argument of the number, which in the element of the sarray.

The problem is that onclicking the link the pframe() executes but does
not display the content in the same place as where the random_mainpage()
displays its content. Also the problem is the images that must be 
displayed, dont get displayed (think its  a cache issuse, can this be 
forces to be displayed.)

Im sure that since this thread had nothing to do with this mailing list
that most others would appreciate that it be taken of the list, taken in
a of the list manner.

If anyone would be so kind as to help, it would be greatly be appreciated.

Kind Regards
Brent Clark

P.s. if someone wants to see a demo of what im trying to do, please 
contact me off the list.

========================
My array
========================
var sarray = new Array();
sarray[1]  = new Array();
	to
sarray[21] = new Array();

sarray[1][0]  = '<table cellspacing="0" cellpadding="0" border="0"
valign="top">';
sarray[1][1]  = '<tr><td class="bold_eight" bgcolor="#e9e9e9"
  >&nbsp;&nbsp;Cape Town</td></tr>';
				TO
sarray[1][23] = '</tr>';
sarray[1][24] = '</table>';


=======================
My javascript function
=======================
function pframe(numb){
	var MyMap = "/images/index/map_"+numb+".gif";
	document['map'].src=MyMap;
	misc = "";
	for(a = 0; a < sarray[numb].length; a++){
		misc += (sarray[numb][a]);
	}
	
	//alert(misc);
	document.getElementById('mainpage').innerHTML = "";
	document.getElementById('mainpage').innerHTML = misc;
	
	document['pic1'].src="/images/index/"+numb+"-1.jpg";
	document['pic2'].src="/images/index/"+numb+"-2.jpg";
	document['pic3'].src="/images/index/"+numb+"-3.jpg";
	document['pic4'].src="/images/index/"+numb+"-4.jpg";
	misc = "";
	MyMap = "";
}

function random_mainpage(element){
	var num = Math.floor( (Math.random() * sarray.length));
	if(num < 0){
		num + 1;
	}
	var MyMap = "/images/index/map_"+num+".gif";
	document['map'].src=MyMap;
	for(a = 0; a < sarray[num].length; a++){
		document.write(sarray[num][a]);
	}
}

=======================
My html code
=======================

<div id="mainpage">
	<script language="javascript">
		random_mainpage()
	</script>
</div>



More information about the thelist mailing list