Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Old 05-30-2004, 07:58 AM Javascript Enquiry
Super Talker

Posts: 104
Location: Northern Ireland
Trades: 0
Hello

I would like to put a code in my web site that would show up if people had their Javascript switched OFF telling them to switch it on and offering a link to do that i.e "We have detected that you are not using Javascript, click here to activate JAVA". I have only seen this once and can not remember where - I nearly always have JAVA on.

Also, and finally, I want Javascript to appear in my Browser thusly <script type="text/javascript" src= etc etc> instead of putting in the entire JAVASCRIPT. So I just link to a JAVASCRIPT held in a seperate file. I have tried doing this and can't see what I am doing wrong. I am using ANTECHINUS JAVASCRIPT EDITOR to do the javascipts (ie I copy and paste them in and then create a new JS and link to it) - but it is only the evaluation version and maybe it does not allow you to do this?

Any help would be much appreciated.

Many Regards

~S
sebastianx is offline
Reply With Quote
View Public Profile Visit sebastianx's homepage!
 
 
Register now for full access!
Old 05-30-2004, 10:32 AM
Unknown.

Posts: 1,693
Trades: 0
Not sure about the first one but to link to an external javascript file enter the following tag before the </head> tag...

Code:
<script language="JavaScript" src="http://domain.com/javascript.js"></script>
Make sure you save the javascript file as a javascript file (.js)

And do NOT include the <SCRIPT LANGUAGE="JavaScript"> and </SCRIPT> tags in the javascript file

Hope this helps

James
Dark-Skys99 is offline
Reply With Quote
View Public Profile
 
Old 05-30-2004, 02:47 PM
Extreme Talker

Posts: 160
Trades: 0
Just to add, you might want to use the type attribute as well ( the 'language' attribute is deprecated in favour of 'type' so use them both for compatibility).

ie

<script src="myScript.js" language="JavaScript" type="text/JavaScript">
</script>

Also, I think you may be getting confused between Java and JavaScript. These are two different languages, one developed by Sun, the other, Netscape.
JavaScript cannot be used to detect if it is, itself, enabled so, instead, there is the <noscript> tag to cater for non-scripting browsers.
Anything you put between <noscript> </noscript> will be displayed by such browsers.
So, you could provide instructions on how to enable scripting, or perhaps a link to a scripting-browser download within this section.
Scripting browsers will ignore this content.
JavaScript can be used to detect if Java is enabled. You can use navigator.javaEnabled( ). This will return true or false as appropriate.

HTH
ElectricSheep is offline
Reply With Quote
View Public Profile
 
Old 05-31-2004, 08:45 AM
Super Talker

Posts: 104
Location: Northern Ireland
Trades: 0
good stuff guys - I have the first point now but one question you say place between head. This I understand for Javascipts that are only placed in the head - what about those placed in the body? Do they alos have to go in the HEAD section?
I have added a few JAVASCRIPTS just fine now with the exception of the DAY Javascipt for adding the day of the week - it does not seem to work at all (although the date does )
sebastianx is offline
Reply With Quote
View Public Profile Visit sebastianx's homepage!
 
Old 05-31-2004, 08:52 AM
Super Talker

Posts: 104
Location: Northern Ireland
Trades: 0
Thank You HTH that problem is now solved. The further question arises . Ok so I use the noscript tag (fine) but rather than write instructions to folk on how to switch on JAVASCRIPT I am 99% sure there is a link or a way of enabling surfersto just click on it to enable their JAVASCRIPTING on their Browsers. MAybe some sort of exe. file (although hopefully not) ?
sebastianx is offline
Reply With Quote
View Public Profile Visit sebastianx's homepage!
 
Reply     « Reply to Javascript Enquiry
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.48272 seconds with 12 queries