Print

Print


> From: Vishwam Annam [mailto:[log in to unmask]]
> Sent: 08 June, 2005 15:37
> To: Code for Libraries
> Subject: Re: [CODE4LIB] Javascript question
>
> *     I have copyright information for Faculty at
> http://www.libraries.wright.edu/services/copyright/fac_staff/, you can see a
> link to "Primary Sources" which is lined to primary.html?Faculty
> *     I have copyright information for Students at
> http://www.libraries.wright.edu/services/copyright/students/, you can see a
> link to "Primary Sources" which is lined to primary.html?Students
> *     If a person is coming from Faculty page, I want to have left navigation bar > (this is a SSI html file) for Faculty
> *     If some one is coming from Students, I want to have the above as Students
>
>       Do you think this is possible with JavaScript? Please let me know if any of > the above info is not clear.

Basically you are trying to include additional content on the page, e.g., the navigation bar.  So my second scenario applies.  Why not just make the navigation bar an iframe?  You can dynamically change the source URL to point to the navigation bar for faculty or students, as my example indicated.

So create two new files for the faculty and student navigation bars.  Next replace:

<!cript type="text/javascript">
a=location.search.substring(1);

if(a=="Faculty")
{
document.write('<strong>Faculty Navigation bar here</strong>');
}

else
if(a=="Students")
{
document.write('<strong>Student Navigation bar here</strong>');
}

</script>

with:

<iframe id='ifrm'></iframe>
<!cript type="text/javascript">
ifrm = document.getElementById("ifrm");
a = location.search.substring(1);
if (a.toLowerCase() == "Faculty".toLowerCase())
  ifrm.src = "http://www.libraries.wright.edu/services/copyright/fac_staff/";
else
  ifrm.src = "http://www.libraries.wright.edu/services/copyright/students/";
</script>

the only downside is that the iframe might get scroll bars, but a
little CSS styling should fix that.


Andy.