Forum     

Go Back   Digit Technology Discussion Forum > Portables, Peripherals and Electronics > QnA (read only)
Register FAQ Calendar Mark Forums Read

QnA (read only) Mods please help transfer the contents of this forum to proper sections. :)


 
 
LinkBack Thread Tools Search this Thread Display Modes
Old 17-07-2006, 06:05 PM   #1 (permalink)
Console Junkie
 
aditya.shevade's Avatar
 
Join Date: Jun 2006
Location: USA
Posts: 991
Default Help Needed with a Java Script


Hi

I need some help with the following java script. I read in this months digit fast track that you can call a js from html so that your source code will remain private. Can I do the same thing with this code? How can I do that? Can anyone tell me?

Please give me the source code of the html file using which I will be able to call this file.


<!-- TWO STEPS TO INSTALL MULTIPLE USERS:

1. Copy the first code into the HEAD of your HTML document
2. Put the last coding into the BODY of your HTML document -->

<!-- STEP ONE: Copy this code into the HEAD of your login HTML document -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function Login(){
var done=0;
var username=document.login.username.value;
username=username.toLowerCase();
var password=document.login.password.value;
password=password.toLowerCase();
if (username=="member1" && password=="password1") { window.location="page1.html"; done=1; }
if (username=="member2" && password=="password2") { window.location="page2.html"; done=1; }
if (username=="member3" && password=="password3") { window.location="page3.html"; done=1; }
if (done==0) { alert("Invalid login!"); }
}
// End -->
</SCRIPT>

<!-- STEP TWO: Paste this code into the BODY of your HTML document -->

<BODY>

<center>
<form name=login>
<table width=225 border=1 cellpadding=3>
<tr><td colspan=2><center><font size="+2"><b>Members-Only Area!</b></font></center></td></tr>
<tr><td>Username:</td><td><input type=text name=username></td></tr>
<tr><td>Password:</td><td><input type=text name=password></td></tr>
<tr><td colspan=2 align=center><input type=button value="Login!" onClick="Login()"></td></tr>
</table>
</form>
</center>

<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size: 1.60 KB -->

Aditya
aditya.shevade is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 17-07-2006, 09:15 PM   #2 (permalink)
Apprentice
 
Join Date: May 2006
Posts: 96
Default Re: Help Needed with a Java Script

simple write the two scripts in two different file with .js extension and in the script tag at appropriate place add src="location and name of your script (.js) file"
__________________
learn how to earn money online : http://howearnmoney.50webs.com
amit_at_stg is offline  
Old 17-07-2006, 10:26 PM   #3 (permalink)
Console Junkie
 
aditya.shevade's Avatar
 
Join Date: Jun 2006
Location: USA
Posts: 991
Default Re: Help Needed with a Java Script

Hi

I want to know how to do that. Suppose I have created 2 js files a.js and b.js and c is my html so what should be the code in a,b and c?

Aditya
aditya.shevade is offline  
Old 17-07-2006, 10:43 PM   #4 (permalink)
Human Spambot
 
Join Date: Nov 2004
Location: Madurai
Posts: 2,349
Default Re: Help Needed with a Java Script

Put the contents of the <script...>...</script> in the above case under a.js (I think the tags script, /script should be included), then in c.html add the tag <script type="text/javascript" src="a.js"></script>

Arun

Last edited by sakumar79; 17-07-2006 at 10:45 PM.
sakumar79 is offline  
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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


 
Latest Threads
- by Tenida
- by Charan
- by abhidev
- by Sujeet
- by Sarath

Advertisement




All times are GMT +5.5. The time now is 09:23 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2