...

View Full Version : help w/ linking from external source...thanks



V1SHAL
07-07-2006, 05:43 AM
Hi...

I have a script that I want to move to an outside source (i.e. remove from the xhtml coding of my webpage and link back to it). How can I alter this script and/or my html code so that I can specify which link i want this to work for and yet keept this entire code out of my xhtml.

In short, what changes can I make to make such a coding, valid...


<script src="PopMeUp_1.js" type="text/javascript"></script>

I currently have this script in my <head> section w/ the following in the body:


<a href="javascript:PopupMe1()">EMAIL UPDATES</a>

This is the script I have:


<script language="JavaScript1.2" type="text/javascript">
var ie=document.all
var dom=document.getElementById
var ns4=document.layers
var calunits=document.layers? "" : "px"
var bouncelimit
var direction="up"
var usedropin=1
function PopupMe1(){
if (!dom&&!ie&&!ns4){
window.open("searchbar.htm", "", "scrollbars=1")}else{
bouncelimit=32 //(must be divisible by 8)
crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin
crossframe=(dom)?document.getElementById("cframe") : ie? document.all.cframe : document.cframe
crossframe.src="searchbar.htm"
if(usedropin){
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
crossobj.top=scroll_top-250+calunits}
crossobj.visibility=(dom||ie)? "visible" : "show"
if(usedropin){
dropstart=setInterval("dropin()",50)}}}
function dropin(){
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
if (parseInt(crossobj.top)<0+scroll_top){
crossobj.top=parseInt(crossobj.top)+40+calunits
if (parseInt(crossobj.top)>0+scroll_top){crossobj.top=0+scroll_top}}else{
clearInterval(dropstart)
bouncestart=setInterval("bouncein()",50)}}
function bouncein(){
crossobj.top=parseInt(crossobj.top)-bouncelimit+calunits
if (bouncelimit<0)
bouncelimit+=8
bouncelimit=bouncelimit*-1
if (bouncelimit==0){
clearInterval(bouncestart)}}
function dismissbox(){
if (window.bouncestart) clearInterval(bouncestart)
crossobj.visibility="hidden"}
function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body}
</script>


<a href="javascript:PopupMe1()">SEARCH</a>
<span id="dropin" style="position:absolute;left:435;visibility:hidden;width:304px;height:50px;background-color:#F5F5F5;border:none;">
<span align="left" style="background-color:white"><a href="#" onClick="dismissbox();return false"><span style='text-decoration:none;color:black;'>[X]</span></a></span>
<IFRAME ID="cframe" SRC="" width=300 height=97 FRAMEBORDER=0 scrolling=no></IFRAME></span>
</span></a>


Thanks for all your help!
Please let me know if my description makes no sense.

Vishal:confused:

_Aerospace_Eng_
07-07-2006, 05:50 AM
Okay had to reread your description a few times. It sounds like you want to move your current JS to an external JS file. You would just put the stuff in between the script tags in an external file with a .js extension

PopMeUp_1.js

var ie=document.all
var dom=document.getElementById
var ns4=document.layers
var calunits=document.layers? "" : "px"
var bouncelimit
var direction="up"
var usedropin=1
function PopupMe1(){
if (!dom&&!ie&&!ns4){
window.open("searchbar.htm", "", "scrollbars=1")}else{
bouncelimit=32 //(must be divisible by 8)
crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin
crossframe=(dom)?document.getElementById("cframe") : ie? document.all.cframe : document.cframe
crossframe.src="searchbar.htm"
if(usedropin){
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
crossobj.top=scroll_top-250+calunits}
crossobj.visibility=(dom||ie)? "visible" : "show"
if(usedropin){
dropstart=setInterval("dropin()",50)}}}
function dropin(){
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
if (parseInt(crossobj.top)<0+scroll_top){
crossobj.top=parseInt(crossobj.top)+40+calunits
if (parseInt(crossobj.top)>0+scroll_top){crossobj.top=0+scroll_top}}else{
clearInterval(dropstart)
bouncestart=setInterval("bouncein()",50)}}
function bouncein(){
crossobj.top=parseInt(crossobj.top)-bouncelimit+calunits
if (bouncelimit<0)
bouncelimit+=8
bouncelimit=bouncelimit*-1
if (bouncelimit==0){
clearInterval(bouncestart)}}
function dismissbox(){
if (window.bouncestart) clearInterval(bouncestart)
crossobj.visibility="hidden"}
function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum