/    Sign up×
Community /Pin to ProfileBookmark

Various Java Problems

I am pretty new to javascript, and am having some problems.

my website [url]www.dylancyr.com[/url] is up, but the navigation is frustrating me.
The navigation on each of the gallery pages (photos, graphics, misc) has an onclick javascript so that when you click each element the bar extends, but I want it to remain that way while that link is active. When you click anywhere else on the page the bar retracts.

I know very little about javascript, and the script was taken from various places around the web.

So if you know how to help me, please do so very slooowwwly.

Thank You.

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@dylancyrauthorDec 30.2008 — The script is more or less a bastardation of this code:

http://www.alistapart.com/articles/imagegallery

and looks like this:

document.getElementById('placeholder').src = whichpic.href;

if(document.getElementById('m1').style.width == '75px'){

document.getElementById('m1').style.width = '40px';

}

el = document.getElementById(whichpic.id);

el.style.width = '75px';

active = true;

return false;

} else {

return true;

}

}

function currentitem(whichpic){

el = document.getElementById(whichpic.id);

el.style.width = '40px';

active = false;

}

function m1(){

el = document.getElementById('m1');

el.style.width = '75px';

}

</script>


I'm calling on it in the HTML in the galnav div:



<div id="galnav">

<table>

<tr><td><a onclick="return showPic(this)" onblur="currentitem(this)" href="images/m1.jpg" title="m1" id="m1"></a></td></tr>

<tr><td><a onclick="return showPic(this)" onblur="currentitem(this)" href="images/m2.jpg" title="m2" id="m2"></a></td></tr>

<tr><td><a onclick="return showPic(this)" onblur="currentitem(this)" href="images/m3.jpg" title="m3" id="m3"></a></td></tr>

<tr><td><a onclick="return showPic(this)" onblur="currentitem(this)" href="images/m4.jpg" title="m4" id="m4"></a></td></tr>

<tr><td><a onclick="return showPic(this)" onblur="currentitem(this)" href="images/m5.jpg" title="m5" id="m5"></a></td></tr>

<tr><td><a onclick="return showPic(this)" onblur="currentitem(this)" href="images/m6.jpg" title="m6" id="m6"></a></td></tr>

<tr><td><a onclick="return showPic(this)" onblur="currentitem(this)" href="images/m7.jpg" title="m7" id="m7"></a></td></tr>

<tr><td><a onclick="return showPic(this)" onblur="currentitem(this)" href="images/m8.jpg" title="m8" id="m8"></a></td></tr>

<tr><td><a onclick="return showPic(this)" onblur="currentitem(this)" href="images/m9.jpg" title="m9" id="m9"></a></td></tr>

<tr><td><a onclick="return showPic(this)" onblur="currentitem(this)" href="images/m10.jpg" title="m10" id="m10"></a></td></tr>

</table>

</div>
Copy linkTweet thisAlerts:
@JMRKERDec 30.2008 — Are you sure you are in the correct forum? :eek:

I don't see any JavaScript code in your link. ?

Maybe you want the Java forum? ?
Copy linkTweet thisAlerts:
@jasonahouleDec 30.2008 — It is the onblur event that is doing it. If you don't want that to happen then you could change showpic() function to check the other elements and change their size when one is clicked.

Also, Java and Javascript are not the same thing.
Copy linkTweet thisAlerts:
@dylancyrauthorDec 30.2008 — AH I'm sorry, I mis-named the thread!

Obviously having javaSCRIPT problems, not java.

Also, If I take out the onBlur part of the code, the elements stay permanently expanded, rather than retract as their element loses focus
Copy linkTweet thisAlerts:
@jasonahouleDec 30.2008 — Exactly. You will have to add that functionality to your showpic() function.
×

Success!

Help @dylancyr spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...