Welcome Guest [Log In] [Register]
Welcome to The New Coffee Room. We hope you enjoy your visit.


You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
javascript question
Topic Started: Jun 19 2006, 06:46 AM (105 Views)
pianojerome
Member Avatar
HOLY CARP!!!
I'm stuck on a problem with coding.


What I want to do is have a list of links in the first cell of a table, and then have each link display a different array of images in the second cell of the table, without actually loading a new page. So it should work just like this:

http://www-personal.umich.edu/~samzerin/bi...ight/index.html


except there will only be one page that creates the images on the fly, rather than having to create a million different pages, one for each link.



I got it to do that, but now here is the problem that I'm having trouble with: I want a link to remain bold as long as its pictures are displayed, but then when another link is clicked, I want the previous link to unbold, so only one link is bolded at a time.


The error that I have with my code now is that it is for some reason not recognizing the returned value 'z', which identifies the link that was just clicked.

What am I doing wrong here?


Code:
 

<script language="javascript">
<!--

var z

function june7airport(z)
{

alert(z);

var n=document.getElementById(z)
n.className='textnobold';

var z="j7airport";

var album = new Array()
album[0] = "<img src='http://photos-572.facebook.com/ip007/v28/227/97/2236153/n2236153_31948572_4909.jpg'>"

var x=document.getElementById('israel').rows[0].cells;
x[1].innerHTML="<font color=99ccff>"+album+"</font>";

y=document.getElementById(z)
y.className='textbold';

z="j7airport";
return z;

}

//------------------------

function june7caesarea(z)
{

alert(z);

var n=document.getElementById(z)
n.className='textnobold';

var z="j7caesarea";

var album = new Array()
album[0] = "<img src='http://photos-573.facebook.com/ip007/v28/227/97/2236153/n2236153_31948573_5391.jpg'>"
album[1] = "<img src='http://photos-574.facebook.com/ip007/v28/227/97/2236153/n2236153_31948574_5866.jpg'>"

var x=document.getElementById('israel').rows[0].cells;
x[1].innerHTML="<font color=99ccff>"+album+"</font>";

y=document.getElementById(z)
y.className='textbold';

return z;

}

//-->
</script>


<style type="text/css">
<!--
a:link {color: #000099}
a:visited {color: #000099}
a:active {color: #000099}
.textbold {font-weight: bold}
.textnobold {font-weight: normal}
-->
</style>


[...]


<div id="j7airport">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0);" onClick="june7airport(z);">Ben Gurion Airport, Tel Aviv</a></div>
<div id="j7caesarea">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0);" onClick="june7caesarea(z);">Caesarea</a></div>

Sam
Offline Profile Quote Post Goto Top
 
The 89th Key
Member Avatar

Sam, if you don't find your answer, let me know I have a few friends that might know the answer...but I think someone here might help you better/quicker.
Offline Profile Quote Post Goto Top
 
LWpianistin
Member Avatar
HOLY CARP!!!
oh god. bad memories from programming class in high school are flooding back.

:hide:
And how are you today?
Offline Profile Quote Post Goto Top
 
pianojerome
Member Avatar
HOLY CARP!!!
I think a problem might be in here:

Code:
 
var n=document.getElementById(z)
n.className='textnobold';


from

Code:
 
function june7airport(z)
{

alert(z);

var n=document.getElementById(z)
n.className='textnobold';

var z="j7airport";

[...]


because it won't even load the images with those couple lines in there (removing them makes the images show up). But it still doesn't seem to be recognizing the output.
Sam
Offline Profile Quote Post Goto Top
 
LWpianistin
Member Avatar
HOLY CARP!!!
nevermind
And how are you today?
Offline Profile Quote Post Goto Top
 
Radu
Member Avatar
Senior Carp
pianojerome
Jun 19 2006, 05:46 PM
I'm stuck on a problem with coding.



Well, don't bother. I disabled (actually uninstalled) Java on my computer.

I guess, I won't see your pictures....

BTW, if you are not a dedicated photographer, postcards and photoalbums are the best choice.
Posted Image
------------------------------------------------------------
"Whenever I hear of culture... I release the safety-catch of my Browning!"
The modern media has made cretins out of so many people that they're not interested in reality any more, unless it's reality TV (Jean D'eaux)
Offline Profile Quote Post Goto Top
 
« Previous Topic · The New Coffee Room · Next Topic »
Add Reply