Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Problem with javascript in a tag
Old 11-17-2007, 12:03 PM Problem with javascript in a tag
pealo86's Avatar
Super Spam Talker

Posts: 849
Name: Matt Pealing
Location: England, north west
Trades: 0
I have a page which uses a hidden div, that can be made visible using a link. This then displays various information which can be changed using links within it.

But each time I click a link on the page, the div dissappears again!

here is the code in the a tag that Im using:

Code:
<a onclick="javascript:Show('overlay');" href="index.php?workId=1#img">Apollyon</a></li><li><a onclick="javascript:Show('overlay');" href="index.php?workId=2#img">jaadoo</a>
Is this code correct or am I missing something?
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
pealo86 is offline
Reply With Quote
View Public Profile Visit pealo86's homepage!
 
 
Register now for full access!
Old 11-17-2007, 03:09 PM Re: Problem with javascript in a tag
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
You are just showing us the function call. It's useless, we need to see the complete function(s) to help you
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 11-17-2007, 03:20 PM Re: Problem with javascript in a tag
pealo86's Avatar
Super Spam Talker

Posts: 849
Name: Matt Pealing
Location: England, north west
Trades: 0
oh! here is the code for the function

Code:
function hide(str) {
x = document.getElementById(str);
x.style.visibility = 'hidden';
}
function Show(str) {
x = document.getElementById(str);
x.style.visibility = 'visible';
}
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
pealo86 is offline
Reply With Quote
View Public Profile Visit pealo86's homepage!
 
Old 11-17-2007, 09:25 PM Re: Problem with javascript in a tag
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Ok

soooo!

You click a link to show an element and with the same click reopen the page, what would be your guess at the problem?

__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-18-2007, 08:26 AM Re: Problem with javascript in a tag
pealo86's Avatar
Super Spam Talker

Posts: 849
Name: Matt Pealing
Location: England, north west
Trades: 0
Yeah I know thats the problem, but do you know if theres a relatively easy solution to fixing it? Or would it be easier to just use a completely different method that doesn't involve a hidden div?
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
pealo86 is offline
Reply With Quote
View Public Profile Visit pealo86's homepage!
 
Old 11-18-2007, 09:00 AM Re: Problem with javascript in a tag
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
each time you open the page call the show() function.

Though to cover for UAs that have no javascript capabilities, the best way is to open the page with all hidden elements shown, then use a javascript call to hide them all, and show the default with an onload event.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-18-2007, 11:37 AM Re: Problem with javascript in a tag
pealo86's Avatar
Super Spam Talker

Posts: 849
Name: Matt Pealing
Location: England, north west
Trades: 0
Thanks I'll keep that in mind
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
pealo86 is offline
Reply With Quote
View Public Profile Visit pealo86's homepage!
 
Reply     « Reply to Problem with javascript in a tag
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.86467 seconds with 12 queries