Solved

JSP & JavaScript...

Posted on 2003-11-18
7
575 Views
Last Modified: 2006-11-17
My question is, is there a way to take a label and give it a js onClick() meth and have that control a JSP action in loading a page in the current one but without needing to refresh the page or would that require loading a few layers, making the one i want visible, visible, and the others not...?
And if there is a way to do this please let me know, thanks.

thank you for the help

- nc
0
Comment
Question by:B000GT
  • 3
  • 3
7 Comments
 
LVL 6

Expert Comment

by:jarasa
ID: 9777423
Hi Booogt.

I'm sorry but I really don't get what you want to do, anyway if you have to do any process at the server side you have to refresh the page.

You can make a text have a OnClick() this way:
<a href=# OnClick()="javascript:whatever()">My Text</a>

If you could be more specific on your needs, maybe I'll be able to help you better.

Have Fun
Javier
0
 
LVL 1

Author Comment

by:B000GT
ID: 9779345
ok well the idea here is to remove the new page stuff
<label name="band_info" onClick(<%! pageToLoad="content.jsp" %>)>Home</label>

now when i click on this i want a target to change on the click without refreshing the page...
does that help to explain what i want a little better?

thanks

- nc
0
 
LVL 6

Expert Comment

by:jarasa
ID: 9779433
I think it doesn't.

You want to open a new page fron that label? I mean when you click on the label you want a new page to be opened in a difernet window?

Sorry but I still don't get your pourpuses.

Javier
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 1

Author Comment

by:B000GT
ID: 9779762
lol
ok here goes again

i want to set a target in the middle of the page: X
---------------------------------
|      A    B    C   D             |
|                                      |
|                                      |
|                  X                  |
|                                      |
|                                      |
---------------------------------
A, B, C, & D are all labels...if i click on A or B or C or D i want X to change without refreshing the page, JUST the place that X is at.

let me know if i need to clearify any more
thank you for your help

- nc
0
 

Expert Comment

by:webhsu
ID: 9781148
Have you tried using frames?
give the frames id's, and have only that frame with X in it refresh.
0
 
LVL 1

Author Comment

by:B000GT
ID: 9783485
the point is to change the content without having to click the back button 5 times to leave the whole page, click it once and you go to the previous page, plus it looks nice, if i have to i'll just have the whole page show because i import most of the pages so they all are compiled and in the cache which reduces the load time

if there is no way to do it then i'll either make it or just have the page load

thanks for all the help

- nc
0
 
LVL 6

Accepted Solution

by:
jarasa earned 325 total points
ID: 9785456
Hi there.
If you already have the data you want to put on the X point you should use Hidden <Div> and when you click on the label just show the appropiated <DIV>, something like this:

<div id="XpoinA" style="z-index:1; position:absolute; left:10px; width:754px; top:30px; height:369px; visibility:hidden">
Your data for when you click on A
</div>
<div id="XpoinB" style="z-index:1; position:absolute; left:10px; width:754px; top:30px; height:369px; visibility:hidden">
Your data for when you click on B
</div>
<div id="XpoinC" style="z-index:1; position:absolute; left:10px; width:754px; top:30px; height:369px; visibility:hidden">
Your data for when you click on C
</div>

<label name="Alabel" onClick="JavaScript:document.all.XpoinA.style.visibility= 'visible';">A</label>
<label name="Blabel" onClick="JavaScript:document.all.XpoinB.style.visibility= 'visible';">B</label>
<label name="Clabel" onClick="JavaScript:document.all.XpoinC.style.visibility= 'visible';">C</label>

You should probably have to hide the other 2 <div> each time you make one visible in order to don't have unexpected data on the page.

Hope it helps.

If you don't have all the Data you want to show you must use Frames and refresh it calling the server with the Target option.

Javier

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
default methods vs abstract class 1 118
attribute vs parameter and setter vs add method 17 89
java operators 3 120
null output 3 35
If you are looking at this article, you have most likely been hit by some version of ransomware and are trying to find out if there is anything you can do, or what way you should react - READ ON!
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question