Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Netscape - changing window contents etc. 1

Status
Not open for further replies.

liefr

Programmer
Nov 9, 1999
11
US
I hope I am in the right place. I have taken over maintenance of a system written with Javascript and TCL to format the HTML. Whenever some new information is to be presented, a new window is opened using a statement like this;<br>
puts &quot;&lt;a href='#' onClick=tpa2aUpdateObj=window.open('tpa-frames.sgi?tpa_id=$tpa_id','wTpa2aUpdate$w','width=690,height=640,top=5,left=10,scrollbars=1,resizable=1,toolbar=1,status=1,alwaysLowered=1');tpa2aUpdateObj.focus()&gt;$displayTpaName&lt;/a&gt;&quot;<br>
<br>
Sorry for the lousy formatting. The 'tpa-frames.sgi' is a TCL script that formats the HTML for the screen.<br>
When this link is clicked a new window is opened (and works fine) but the originating window(a list of links) refreshes itself and presents from the top again. This irritates my client because he must scroll down to the link again when he wants to go on to the next one. <br>
Question 1: how can I make the originating window remain where it is? The 'wTpa2aUpdate$w' value in the link is unique. Can it be used for position? <br>
Question 2: All of the links in the originating window show the vlink color whether they have been visited or not. When they are clicked they show the alink color during mousedown. Why do they all show the vlink color by default? <br>
Thanks in advance for any help.<br>
Lief <br>

 
Your difficulty lies with the fact that Netscape doesn't have quite as complete an object model as IE at present (NS 5.0 will change that): The &lt;a href='#' is a &quot;fake&quot; hyperlink which by default refreshes the current page (# combined with a value is used for an anchor to another position on the page; by itself it just refreshes the whole page). The reason a hyperlink is used at all is that you cannot attach an onclick event to a standard text object in netscape. In IE 4 and 5 this is possible, and would eliminate the need for the blank hyperlink that refreshes the current page.<br>
<br>
This also explains why all the links have the vlink color--they ARE all the same link: &quot;#&quot;. The javascript used is not part of the link at all but an attached event.<br>
<br>
If you only wanted to support IE 4 and up, you could use:<br>
<br>
&lt;font onClick=tpa2aUpdateObj=window.open(etc...&gt;$displayTpaName&lt;/font&gt;<br>
<br>
If you want to support any browser with Javascript, a couple ways around this problem are as follows:<br>
<br>
1. Have the onclick event generated from an image next to the text that displays the value, as images can have an onclick behavior without a hyperlink.<br>
<br>
&lt;img src=&quot;whatever.gif&quot; onClick=tpa2aUpdateObj=window.open(etc....&gt;&lt;font&gt;$displayTpaName&lt;/font&gt;<br>
<br>
2. Have the onclick event generated from a form button, which also doesn't need a hyperlink to generate the event, but CAN display the values for the description.<br>
<br>
&lt;form&gt;<br>
&lt;input type=&quot;button&quot; name=&quot;whatever&quot; value=$displayTpaName onClick=tpa2aUpdateObj=window.open(etc....&gt;<br>
&lt;/form&gt;<br>
<br>
With either of the two final options a new page will be opened but the existing page will not be refreshed. Works for Netscape 2 and up and IE 3 and up.
 
Rycamor; Thank you very much for the help. I could not drag this info out of the books I have. Since the '#' is a fake hyperlink and I have a counter ($w) being incremented for each link, could I append the counter to the '#' and have a unique link? (I am thinking minimum changes here). If it is unique then the originating screen will not refresh and my link color will be right.
 
I was so excited that I asked instead of trying. I changed the # to be #T$w and sure enough the link colors are individual now. The screen does still refresh although I notice that if I use the 'back' button I get the previous position. Do I need to trap that link value and apply logic to skip internally to that link position on a refresh?<br>
I notice that the vlink color is very persistant now. I know.. complain complain... but how do you reset to the link color? I shutdown netscape and restarted but the visited links held the vlink color. <br>
Can you recommend a good book that contains these tidbits about netscape? I have a dozen other things to figure out and change as well and I don't want to be a pest. <br>
Thanks again.<br>
Lief
 
I said the # was a &quot;fake&quot; hyperlink, not a FAKE one. In other words, in this case it was being USED as a fake hyperlink. The original purpose of the '#' was to create links that can scroll to other targets on the same page. Read the documentation on HTML targets.<br>
<br>
What you can do, if you want to append a value to the '#', is make that a target IN your HTML somewhere right beside the link, in which case the page will refresh and scroll to that spot.<br>
<br>
For Netscape info on Javascript, DHTML and HTML The best bet is go to <A HREF=" TARGET="_new"><br>
You will find they have a much better organized catalog of their technology than the folks at Micro$oft.<br>
<br>
Good luck
 
Well, the way I see it, you can do this too:<br>
<br>
puts &quot;&lt;a href='#' onClick=\&quot;tpa2aUpdateObj=window.open('tpa-frames.sgi?tpa_id=$tpa_id','wTpa2aUpdate$w','width=690,height=640,top=5,left=10,scrollbars=1,resizable=1,toolbar=1,status=1,alwaysLowered=1');tpa2aUpdateObj.focus();<b>return false</b>\&quot;&gt;$displayTpaName&lt;/a&gt;&quot;<br>
<br>
all I did was modify the onClick with:<br>
1) added <i>; return false</i> to the end<br>
2) added double quotes <i>&quot;</i> with a backslash in front (to disregard as a ending quote)<br>
<br>
that should work, the key is the <b><i>return false</b></i>.<br>
If the above doesn't work, then try adding in the return false in some other way. <p>theEclipse<br><a href=mailto: > </a><br><a href=robacarp.webjump.com>robacarp.webjump.com</a><br>
 
Does anyone here realize that you can have javascript code as a link:<br>
&lt;a href=&quot;javascript:blah()&quot;&gt;something&lt;/a&gt; <p>REH<br><a href=mailto:hawkdogg@crosswinds.net>hawkdogg@crosswinds.net</a><br><a href= by Linux</a><br>Learn Linux and Leave out the Windows :)
 
I could not get the 'return false' to work (I expected it to not refresh the calling screen). What I did was change my links to not open a new window on several of the pages. This makes the link color change immediately, maintains the position of the calling page and allows the back and forward buttons to be used for navigation. The way I did this is just what ndogg said, I call the script straight from the href ie;<br>
puts &quot;&lt;a href='tpa-frames.sgi?tpa_id=$tpa_id';&gt;$displayTpaName&lt;/a&gt;&quot;<br>
<br>
This works and is easier to read too.<br>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top