HighDots Forums  

how to fix this

JavaScript discussion (multi-lingual) JavaScript discussion (alt.comp.lang.javascript)


Discuss how to fix this in the JavaScript discussion (multi-lingual) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Eric
 
Posts: n/a

Default how to fix this - 03-13-2006 , 05:50 PM






I've got a table (in a frame) like the sample below where the whole cell is
click-able. This works well except I'd like the cells to show standard link
behavior for the cell text, so if the cell link has been visited the cell
text would be a diferent color etc. Any ideas on how to do this?
Thanks
Eric

<TABLE id="test" border='0' cellspacing='0' cellpadding='0'>
<TR
onmouseover="this.style.background='#0860a8';this. style.cursor='pointer'"
onmouseout="this.style.background='';"
onclick="parent.top.location='http://home_loc.com'">
<td>Home</td>
</TR>
<TR
onmouseover="this.style.background='#0860a8';this. style.cursor='pointer'"
onmouseout="this.style.background='';"
onclick="parent.Window.location='Travels/Travels.html'">
<td>Our Travels</td>
</TR>
</TABLE>

Reply With Quote
  #2  
Old   
Mike Scirocco
 
Posts: n/a

Default Re: how to fix this - 03-13-2006 , 11:06 PM






Eric wrote:
Quote:
I've got a table (in a frame) like the sample below where the whole cell is
click-able. This works well except I'd like the cells to show standard link
behavior for the cell text, so if the cell link has been visited the cell
text would be a diferent color etc. Any ideas on how to do this?
Thanks
Eric

TABLE id="test" border='0' cellspacing='0' cellpadding='0'
TR
onmouseover="this.style.background='#0860a8';this. style.cursor='pointer'"
onmouseout="this.style.background='';"
onclick="parent.top.location='http://home_loc.com'"
td>Home</td
/TR
TR
onmouseover="this.style.background='#0860a8';this. style.cursor='pointer'"
onmouseout="this.style.background='';"
onclick="parent.Window.location='Travels/Travels.html'"
td>Our Travels</td
/TR
/TABLE
How about this approach:

onclick="parent.document.location.href='http://home_loc.com'">

onclick="parent.document.location.href='http://www.google.com'">

<!-- Travels/Travels.html -->

Mike


Reply With Quote
  #3  
Old   
Randy Webb
 
Posts: n/a

Default Re: how to fix this - 03-13-2006 , 11:53 PM



Eric said the following on 3/13/2006 6:50 PM:
Quote:
I've got a table (in a frame) like the sample below where the whole cell is
click-able. This works well except I'd like the cells to show standard link
behavior for the cell text, so if the cell link has been visited the cell
text would be a diferent color etc. Any ideas on how to do this?
If you want it to behave like a link, use a link. Then the browser does
all the work. Short of that, include in the onclick a call to change the
CSS class:

onclick="this.className = 'clicked'";

Where clicked is a class in CSS that uses underline and color changes to
mimick links.


<style type="text/css">
..clicked{
text-decoration: underline;
color: #000000;
background-color: #FFFFFF;
}
</style>

Quote:
Thanks
Eric

TABLE id="test" border='0' cellspacing='0' cellpadding='0'
TR
onmouseover="this.style.background='#0860a8';this. style.cursor='pointer'"
onmouseout="this.style.background='';"
onclick="parent.top.location='http://home_loc.com'"
top isn't a good name for a frame, its going to cause you problems as
top is a reserved word in JS.

Quote:
td>Home</td
/TR
TR
onmouseover="this.style.background='#0860a8';this. style.cursor='pointer'"
onmouseout="this.style.background='';"
onclick="parent.Window.location='Travels/Travels.html'"
Do you have a frame window named Window? Thats another that will cause
you grief if you ever lowercase it by accident: parent.window.location

Quote:
td>Our Travels</td
/TR
/TABLE

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


Reply With Quote
  #4  
Old   
Randy Webb
 
Posts: n/a

Default Re: how to fix this - 03-13-2006 , 11:53 PM



Mike Scirocco said the following on 3/14/2006 12:06 AM:
Quote:
Eric wrote:
I've got a table (in a frame) like the sample below where the whole
cell is
click-able. This works well except I'd like the cells to show standard
link
behavior for the cell text, so if the cell link has been visited the cell
text would be a diferent color etc. Any ideas on how to do this?
Thanks
Eric

TABLE id="test" border='0' cellspacing='0' cellpadding='0'
TR

onmouseover="this.style.background='#0860a8';this. style.cursor='pointer'"
onmouseout="this.style.background='';"
onclick="parent.top.location='http://home_loc.com'"
td>Home</td
/TR
TR

onmouseover="this.style.background='#0860a8';this. style.cursor='pointer'"
onmouseout="this.style.background='';"
onclick="parent.Window.location='Travels/Travels.html'"
td>Our Travels</td
/TR
/TABLE

How about this approach:

onclick="parent.document.location.href='http://home_loc.com'"

onclick="parent.document.location.href='http://www.google.com'"
That won't change the color/underline of the text that was clicked on,
to mimic a link.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


Reply With Quote
  #5  
Old   
Eric
 
Posts: n/a

Default Re: how to fix this - 03-13-2006 , 11:55 PM



Mike Scirocco wrote:

Quote:
Eric wrote:
I've got a table (in a frame) like the sample below where the whole cell
is click-able. This works well except I'd like the cells to show standard
link behavior for the cell text, so if the cell link has been visited the
cell text would be a diferent color etc. Any ideas on how to do this?
Thanks
Eric

TABLE id="test" border='0' cellspacing='0' cellpadding='0'
TR

onmouseover="this.style.background='#0860a8';this. style.cursor='pointer'"
onmouseout="this.style.background='';"
onclick="parent.top.location='http://home_loc.com'"
td>Home</td
/TR
TR

onmouseover="this.style.background='#0860a8';this. style.cursor='pointer'"
onmouseout="this.style.background='';"
onclick="parent.Window.location='Travels/Travels.html'"
td>Our Travels</td
/TR
/TABLE

How about this approach:

onclick="parent.document.location.href='http://home_loc.com'"

onclick="parent.document.location.href='http://www.google.com'"

!-- Travels/Travels.html --

Mike
Well, thanks for answering but i think you missed the point. How is that
going to fix my problem? Maybe I'm not explaining this well enough. I want
the color of the text in between <td> and </td> to change just like if it
was a link and not just plain text. ie: if you click on the cell to go to
wherever the cell points to the text should change color to the same color
as a visited link color would be.
Eric



Reply With Quote
  #6  
Old   
Randy Webb
 
Posts: n/a

Default Re: how to fix this - 03-14-2006 , 12:03 AM



Eric said the following on 3/14/2006 12:55 AM:

<snip>

Quote:
Well, thanks for answering but i think you missed the point. How is that
going to fix my problem? Maybe I'm not explaining this well enough. I want
the color of the text in between <td> and </td> to change just like if it
was a link and not just plain text. ie: if you click on the cell to go to
wherever the cell points to the text should change color to the same color
as a visited link color would be.
Then you follow my first advice in my other reply. If you want it to act
and behave like a link, use a link.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


Reply With Quote
  #7  
Old   
Wojtek Bok
 
Posts: n/a

Default Re: how to fix this - 03-14-2006 , 09:04 AM



Eric wrote:
Quote:
Mike Scirocco wrote:


Eric wrote:

I've got a table (in a frame) like the sample below where the whole cell
is click-able. This works well except I'd like the cells to show standard
link behavior for the cell text, so if the cell link has been visited the
cell text would be a diferent color etc. Any ideas on how to do this?
Thanks
Eric

TABLE id="test" border='0' cellspacing='0' cellpadding='0'
TR


onmouseover="this.style.background='#0860a8';this. style.cursor='pointer'"

onmouseout="this.style.background='';"
onclick="parent.top.location='http://home_loc.com'"
td>Home</td
/TR
TR


onmouseover="this.style.background='#0860a8';this. style.cursor='pointer'"

onmouseout="this.style.background='';"
onclick="parent.Window.location='Travels/Travels.html'"
td>Our Travels</td
/TR
/TABLE

How about this approach:

onclick="parent.document.location.href='http://home_loc.com'"

onclick="parent.document.location.href='http://www.google.com'"

!-- Travels/Travels.html --

Mike

Well, thanks for answering but i think you missed the point. How is that
going to fix my problem? Maybe I'm not explaining this well enough. I want
the color of the text in between <td> and </td> to change just like if it
was a link and not just plain text. ie: if you click on the cell to go to
wherever the cell points to the text should change color to the same color
as a visited link color would be.
Eric

Keep a status variable for each link. Use onClick to go to a function
which changes the state of the variable and changes the CSS for the link
(thus changing its colour). Use Ajax to send the new state back to your
server. Finally visit the link.

When refreshing the page, use the state information to set the starting
values for the variable and CSS.


Reply With Quote
  #8  
Old   
Eric
 
Posts: n/a

Default Re: how to fix this - 03-14-2006 , 03:18 PM



Wojtek Bok wrote:

Quote:
Eric wrote:
Mike Scirocco wrote:


Eric wrote:

I've got a table (in a frame) like the sample below where the whole cell
is click-able. This works well except I'd like the cells to show
standard link behavior for the cell text, so if the cell link has been
visited the cell text would be a diferent color etc. Any ideas on how to
do this? Thanks
Eric

TABLE id="test" border='0' cellspacing='0' cellpadding='0'
TR


onmouseover="this.style.background='#0860a8';this. style.cursor='pointer'"

onmouseout="this.style.background='';"
onclick="parent.top.location='http://home_loc.com'"
td>Home</td
/TR
TR


onmouseover="this.style.background='#0860a8';this. style.cursor='pointer'"

onmouseout="this.style.background='';"
onclick="parent.Window.location='Travels/Travels.html'"
td>Our Travels</td
/TR
/TABLE

How about this approach:

onclick="parent.document.location.href='http://home_loc.com'"

onclick="parent.document.location.href='http://www.google.com'"

!-- Travels/Travels.html --

Mike

Well, thanks for answering but i think you missed the point. How is that
going to fix my problem? Maybe I'm not explaining this well enough. I
want the color of the text in between <td> and </td> to change just like
if it was a link and not just plain text. ie: if you click on the cell to
go to wherever the cell points to the text should change color to the
same color as a visited link color would be.
Eric

Keep a status variable for each link. Use onClick to go to a function
which changes the state of the variable and changes the CSS for the link
(thus changing its colour). Use Ajax to send the new state back to your
server. Finally visit the link.

When refreshing the page, use the state information to set the starting
values for the variable and CSS.
Ajax? never heard of it. In any case I wouldnt want to install some new
enivronment just to solve a table cell problem.
Eric



Reply With Quote
  #9  
Old   
Eric
 
Posts: n/a

Default Re: how to fix this - 03-14-2006 , 03:23 PM



Randy Webb wrote:

Quote:
Eric said the following on 3/13/2006 6:50 PM:
I've got a table (in a frame) like the sample below where the whole cell
is click-able. This works well except I'd like the cells to show standard
link behavior for the cell text, so if the cell link has been visited the
cell text would be a diferent color etc. Any ideas on how to do this?

If you want it to behave like a link, use a link. Then the browser does
all the work. Short of that, include in the onclick a call to change the
CSS class:

onclick="this.className = 'clicked'";

Where clicked is a class in CSS that uses underline and color changes to
mimick links.


style type="text/css"
.clicked{
text-decoration: underline;
color: #000000;
background-color: #FFFFFF;
}
/style

Thanks
Eric

TABLE id="test" border='0' cellspacing='0' cellpadding='0'
TR

onmouseover="this.style.background='#0860a8';this. style.cursor='pointer'"
onmouseout="this.style.background='';"
onclick="parent.top.location='http://home_loc.com'"

top isn't a good name for a frame, its going to cause you problems as
top is a reserved word in JS.

td>Home</td
/TR
TR

onmouseover="this.style.background='#0860a8';this. style.cursor='pointer'"
onmouseout="this.style.background='';"
onclick="parent.Window.location='Travels/Travels.html'"

Do you have a frame window named Window? Thats another that will cause
you grief if you ever lowercase it by accident: parent.window.location

td>Our Travels</td
/TR
/TABLE


Well, my whole goal was to make the entire cell clickable. top takes me out
of the frames. Window is probably not the best choice, i could easily
change that.
If i use a link in place of the text (which i assume you mean) Then if
they click not the text but the cell to go will the text-link still "know"
its been followed and change color accordingly?
Using a variable to capture link state wont work, when they close the
session and come back 5 days later the variable will be gone.
Eric



Reply With Quote
  #10  
Old   
Randy Webb
 
Posts: n/a

Default Re: how to fix this - 03-14-2006 , 04:16 PM



Eric said the following on 3/14/2006 4:18 PM:
Quote:
Wojtek Bok wrote:

<snip>

Quote:
Keep a status variable for each link. Use onClick to go to a function
which changes the state of the variable and changes the CSS for the link
(thus changing its colour). Use Ajax to send the new state back to your
server. Finally visit the link.

When refreshing the page, use the state information to set the starting
values for the variable and CSS.
Ajax? never heard of it. In any case I wouldnt want to install some new
enivronment just to solve a table cell problem.
AJAX is Asynchronous Javascript and XML. And it is the *worst* way to
get data to the server in a cross-browser environment.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


Reply With Quote
Reply




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.