jon24422531
Technical User
Hi guys
Here is a very good reason to stop cutting and pasting code with out knowing how it works. Sadly I've never really understood JavaScript....
I have an internal website that Emails a User when their helpdesk question has been updated and there is a link:
This opens in a frame thanks to the following code in both the index page:
and also in the opening worklogOpenDetail.asp page:
If I change the link (generated by SQL Mail)
(note that there is an additional folder)
It no longer opens in the frame, but as a new page or tab. What do I need to alter in the JavaScript to get it to point to the new folder and open in the frame as before?
Coding is like Shakespeare; I can read it, even appreciate & understand it, but I could never write it.
Jonathan
Here is a very good reason to stop cutting and pasting code with out knowing how it works. Sadly I've never really understood JavaScript....
I have an internal website that Emails a User when their helpdesk question has been updated and there is a link:
This opens in a frame thanks to the following code in both the index page:
Code:
<SCRIPT LANGUAGE="JavaScript">
<!--
defaultsubpage="UserStart.asp";
if (location.search) {subpage=location.search.substring(1)}
else {subpage=defaultsubpage}
if (subpage.indexOf('&&&')>=0) {
prefix=subpage.substring(0,subpage.indexOf('&&&'))+"://";
suffix=subpage.substring(subpage.indexOf('&&&')+3,subpage.length);
subpage=prefix+suffix;
}
// -->
</SCRIPT>
</HEAD>
<SCRIPT>
document.write('<FRAMESET ROWS="10,*,0" BORDER="0" FRAMEBORDER=No FRAMESPACING="0">');
document.write('<FRAME NAME = "HEAD" SRC="Header.html" BORDER="0" FRAMEBORDER=No SCROLLING="NO" NORESIZE >');
document.write('<FRAMESET COLS="200,*" BORDER="0" FRAMEBORDER=No FRAMESPACING="0">');
document.write('<FRAME NAME = "NAV" SRC="Navigate.asp" BORDER="0" FRAMEBORDER=No SCROLLING="NO" NORESIZE >');
document.write('<FRAME NAME = "CENTER" SRC="'+subpage+'" BORDER="0" FRAMEBORDER=No SCROLLING="AUTO">');
document.write('</FRAMESET>');
</SCRIPT>
Code:
<script>
function detect()
{
framesetpage="Index.html";
thispage=window.location.href;
if (thispage.indexOf('://')<0) {thispage="://"+thispage;};
prefix=thispage.substring(0,thispage.lastIndexOf('://'));
suffix=thispage.substring(thispage.lastIndexOf('://')+3,thispage.length);
// alert('the subpage is:['+prefix+']['+suffix+']');
if (parent.location.href==window.location.href) {parent.location.href=framesetpage+"?"+prefix+"&&&"+suffix};
}
</script>
If I change the link (generated by SQL Mail)
(note that there is an additional folder)
It no longer opens in the frame, but as a new page or tab. What do I need to alter in the JavaScript to get it to point to the new folder and open in the frame as before?
Coding is like Shakespeare; I can read it, even appreciate & understand it, but I could never write it.
Jonathan