Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question help w/ linking from external source...thanks

    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...

    Code:
    <script src="PopMeUp_1.js" type="text/javascript"></script>
    I currently have this script in my <head> section w/ the following in the body:

    Code:
    <a href="javascript:PopupMe1()">EMAIL UPDATES</a>
    This is the script I have:

    Code:
    <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>
    Code:
    <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
    Last edited by V1SHAL; 07-07-2006 at 04:46 AM.

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    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
    Code:
    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}
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •