Solved

JSP & JavaScript...

Posted on 2003-11-18
7
554 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 1

Author Comment

by:B000GT
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article explains in simple steps how to renew expiring Exchange Server Internal Transport Certificate.
Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now