linking from an external source

This is a discussion on "linking from an external source" within the JavaScript Forum section. This forum, and the thread "linking from an external source are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jul 7th, 2006, 03:15
New Member
Join Date: Jul 2006
Location: Phila., USA
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Question linking from an external source

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 xhtml 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: Select all
<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: Select all
<a href="javascript:PopupMe1()">EMAIL UPDATES</a>


This is the script I have:

Code: Select all
<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>

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

Vishal
Reply With Quote

  #2 (permalink)  
Old Jul 7th, 2006, 18:23
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
Re: linking from an external source

If I'm understanding what you are showing us correctly, you do not want the <script... elements in your seperate script file. You have already included them in your main file.
Reply With Quote
  #3 (permalink)  
Old Jul 7th, 2006, 19:16
New Member
Join Date: Jul 2006
Location: Phila., USA
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: linking from an external source

Correct...

I would need to remove the script elements when I move it to an external file.

My question was really more related to the link back procedure.

Normally, I'd load the script in the header as such:

<script src="PopMeUp_1.js" type="text/javascript"></script>
but how do i then call this script up with the link on my main page?
Reply With Quote
  #4 (permalink)  
Old Jul 7th, 2006, 19:47
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
Re: linking from an external source

Exactly as normal.

The browser incorporates your javascript file in with the html file as if they were one.
Reply With Quote
Reply

Tags
linking, external, source

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Best open source CMS goldy Webforumz Cafe 19 Apr 1st, 2008 14:08
Linking to external site without <iframe> esquivelia Web Page Design 10 Oct 30th, 2007 17:27
Linking to external.swf movie wenric Flash & Multimedia Forum 3 Sep 3rd, 2006 17:10
Linking to an external style sheet ahm531 Web Page Design 6 Aug 31st, 2006 13:23
View Source Costabrava Web Page Design 6 Feb 23rd, 2004 19:08


All times are GMT. The time now is 11:03.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43