load javascript file

This is a discussion on "load javascript file" within the JavaScript Forum section. This forum, and the thread "load javascript file 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 Apr 24th, 2007, 16:41
Junior Member
Join Date: Apr 2007
Location: england
Age: 20
Posts: 18
Thanks: 0
Thanked 1 Time in 1 Post
load javascript file

i am using the following code:

Code: Select all
<script language="JavaScript" type="text/javascript" src="pwd1.js">
which should take this peice of coding:
Code: Select all
<script language="Javascript">

<!--

var password = "password"
var x = prompt("Enter in the password "," ")
if (x.toLowerCase() == password) {
alert("Password correct \n \n Click OK to proceed")
location = "results.html"
}

else {
location = "incorrect.html"
}

//-->

</script>
it is going in the head of the page, basically it will bring up a prompt box wher the user will be required to insert a set password to proceed...

the code isnt doing what it should be, i dont get a prompt box appear, just a page with background...

can anyone help

Last edited by karinne; Apr 24th, 2007 at 16:43. Reason: Please use [code]...[/code] tags when displaying code!
Reply With Quote

  #2 (permalink)  
Old Apr 26th, 2007, 01:31
Reputable Member
Join Date: Jul 2006
Location: Scotland
Age: 22
Posts: 357
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to snow
Re: load javascript file

I don't understand what you're doing? You're linking to an external file, yet you say that the JavaScript is in the head?

Please clarify what you have currently or post a link?
Reply With Quote
  #3 (permalink)  
Old Apr 26th, 2007, 21:31
Junior Member
Join Date: Dec 2006
Location: London
Age: 20
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Re: load javascript file

I believe he means he's putting the
Code: Select all
<script language="JavaScript" type="text/javascript" src="pwd1.js">
Into the head but the JS code isn't working.
The JS code seems fine i guess, but try changing it to
Code: Select all
<script language="JavaScript" type="text/javascript" src="/js/pwd1.js">
It might just be because your not pointing it to the right directory.
/js/ being a folder new folder name where the script is held.
Reply With Quote
  #4 (permalink)  
Old Apr 26th, 2007, 22:19
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
Re: load javascript file

also, you need to use window.location = "..."
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Reply With Quote
  #5 (permalink)  
Old Apr 26th, 2007, 22:28
Reputable Member
Join Date: Jul 2006
Location: Scotland
Age: 22
Posts: 357
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to snow
Re: load javascript file

call me daft - but why are there script tags around JavaScript in an external file?
Reply With Quote
  #6 (permalink)  
Old Apr 26th, 2007, 22:33
Junior Member
Join Date: Dec 2006
Location: London
Age: 20
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Re: load javascript file

That's what I was wondering, useless .. but as it doesn't effect the script .. meh.
Reply With Quote
  #7 (permalink)  
Old Apr 27th, 2007, 10:55
Reputable Member
Join Date: Jul 2006
Location: Scotland
Age: 22
Posts: 357
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to snow
Re: load javascript file

to my mind the tags should break it, as they're not vaid JavaScript?
Reply With Quote
  #8 (permalink)  
Old Apr 27th, 2007, 15:00
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
Re: load javascript file

what? the tags are on the external file? non-sense.
That's an error, script will not run...
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Reply With Quote
Reply

Tags
java

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
jpg load via xml file quality settings ahwell Flash & Multimedia Forum 9 May 14th, 2008 23:25
Load External .JS File Before Anything Else tox0tes JavaScript Forum 1 Jul 10th, 2007 14:03
SWF file refusing to load up griffonwing Flash & Multimedia Forum 1 Jun 27th, 2007 20:40
The swf file doesn't load properly outside flash Sanoriah Flash & Multimedia Forum 3 Nov 16th, 2006 18:02
Load .swf file with External text in Another Flash document ien Flash & Multimedia Forum 3 Aug 31st, 2006 14:29


All times are GMT. The time now is 10:43.


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