Jump to content
xisto Community
blackhand101

Codes For Js Codes For JS i have managed to pick up

Recommended Posts

here is one code i will post another


<script LANGUAGE="JavaScript"><!--// Use these three variables to set the message, scroll speed and start positionvar msg = "Your Message Here"  //This is the message that will appear in the status bar.var delay = 128   //increase to slow down movementvar startPos = 130   //increase to move start position to the right// Don't touch these variables:var timerID = nullvar timerRunning = falsevar pos = 0// Make it all workScrollit()function Scrollit(){	// Make sure the clock is stopped	StopTheClock()	// Pad the message with spaces to get the "start" position	for (var i = 0; i < startPos; i++) msg = " " + msg	// Off we go...	DoTheScroll()}function StopTheClock(){	if(timerRunning)		clearTimeout(timerID)	timerRunning = false}function DoTheScroll(){	if (pos < msg.length)		self.status = msg.substring(pos, msg.length);	else		pos=-1;	++pos	timerRunning = true	timerID = self.setTimeout("DoTheScroll()", delay)}//--></SCRIPT>


this makes a message scroll down in the status bar
replace a message in the quotation marks like this: "Your Message Here"

Share this post


Link to post
Share on other sites

this next one is not really js but php sendmail code

<?php   // Set this to your email address.   $EMailAddress = "youremail@domain.com";  if (!isset($_POST["Submit"])) {	 Submit_Screen();  } else {	$Value = Check_Submit();	if ($Value > 0) Submit_Screen($Value);	else {	  Post_Submit();	  Display_Thankyou();	}  }  function Submit_Screen()  {	 echo 'You can contact us via the following contact form:<br><br><form method=post>';	 echo '<table border=1 cellpadding=0 cellspacing=0><tr><td><table width=500 border=0 cellpadding=3 cellspacing=0><tr><td>Your Email Address:   <input type=text size=50 name=Email value="'.@$_POST['Email'].'"></td></tr>';	 echo '<tr><td >Message:</td></tr><tr><td><textarea cols=60 rows=10 name=Notes>'.@$_POST['Notes'].'</textarea></td></tr>';	 echo '<tr><td align=center ><input name=Submit type=submit value="Contact Us"></td></tr></table></td></tr></table></form>';  }  function Display_Thankyou()  {	  echo "<center><br><br><font class=\"p14\">Thank you for your feedback!</font></center>";  }  function Post_Submit()  {	global $EMailAddress;	$Now = date("Y-m-d");	$Email = addslashes($_POST["Email"]);	$Notes = addslashes($_POST["Notes"]);	$Message = "Contact Feedback\n$Email\n\n$Notes";	@mail($EMailAddress, "Contact ", $Message, "From: ".$_POST['Email']);  }  function Check_Submit()  {	$Wrong = 0;	if (!isset($_POST['Email']) || empty($_POST['Email'])) $Wrong |= 2;	if (!isset($_POST["Notes"]) || empty($_POST["Notes"])) $Wrong |= 1;	return ($Wrong);  }?>


replace your email in the quotation marks like this:
"youremail@domain.com"

Share this post


Link to post
Share on other sites

Those are some pretty useful codes. Personally, I find most status bar updating javascripts to be somewhat of a nuisance when they constantly update, but that doesn't make them any cooler. The mail form is also pretty good, and may help to prevent spambots from finding your email address if a naive spambot that only checks html pages stumbles across your site.~Viz

Share this post


Link to post
Share on other sites

My name is Lance Flavell. I used to write JavaScript years back when the web was still kind of new.

One of my earlier ones (I think it was 1998 ore there abouts!) was in discovering the new way making dynamic roll-over effects for table cells. In the days when everyone used dial up (I still do oddly enough)... it was a way of having cool menu effects without the wait time for on / off graphics. Back then it was known as JavaScript, although technically, these days you'd more likely call the method DHTML.

<!--Credit:Lance Flavell--><TABLE onMouseover="this.style.backgroundColor='#ff0000'" onMouseout="this.style.backgroundColor='#0000ff'" BGCOLOR="#0000ff" BORDER="4" WIDTH="200"><TD><CENTER><B>DYNAMIC</B></CENTER></TD></TABLE><BR><TABLE onMouseover="this.style.backgroundColor='#ff0000'" onMouseout="this.style.backgroundColor='#0000ff'" BGCOLOR="#0000ff" BORDER="4" WIDTH="200"><TD><CENTER><B>TABLES</B></CENTER></TD></TABLE><BR><TABLE onMouseover="this.style.backgroundColor='#ff0000'" onMouseout="this.style.backgroundColor='#0000ff'" BGCOLOR="#0000ff" BORDER="4" WIDTH="200"><TD><CENTER><B>in</B></CENTER></TD></TABLE><BR></BODY><TABLE onMouseover="this.style.backgroundColor='#ff0000'" onMouseout="this.style.backgroundColor='#0000ff'" BGCOLOR="#0000ff" BORDER="4" WIDTH="200"><TD><CENTER><B>INTERNET EXPLORER 4</B></CENTER></TD></TABLE>

The above code was originally submitted by myself to http://www.javascriptkit.com/script/cut97.shtml... I think they may have called themselves "JavaScript Source" when I originally submitted the code.

Share this post


Link to post
Share on other sites

Here's another one I also wrote which was mildly popular in the day... plays a game of "Guess my number 1-100".

One thing I don't like about my own code is that when they say they want to play again, it restarts by refreshing the whole webpage. I should have made it just pick a new number. Oh well...

 

You can see a working example at: http://www.javascriptkit.com/script/script2/ageguess.shtml

 

Here's the code (Note: in two parts)

 

<script LANGUAGE="JavaScript"><!--;// numberguess is by Lancer - written 4 Jan 1999// lancer@kp.planet.gen.nzvar guessme=Math.round(Math.random()*(99)+1);var speech='Guess my number (from 1 to 100)';function process(mystery) {var guess=document.forms.guessquiz.guess.value;var speech='"'+guess+ '" does not make sense to me.';document.forms.guessquiz.guess.value='';if (guess==mystery){document.forms.guessquiz.prompt.value='Congratulations! '+mystery+' is correct!';alert ('Well done - the mystery number is '+mystery+'! \n\nPress this button to reload the page for another game.');speech='';document.location=document.location;}if (mystery<guess){speech='Less than '+ guess;}if (mystery>guess){speech='Greater than '+ guess;}if (guess==''){speech='You didn\'t guess anything!'}document.forms.guessquiz.prompt.value=speech; document.forms.guessquiz.guess.focus();}// end hide --></SCRIPT>
<FORM onSubmit="" NAME="guessquiz"><CENTER><TABLE ALIGN="CENTER" BGCOLOR="#888888" BORDER="3" CELLPADDING="5"><TR><TD BGCOLOR="#004080"><FONT COLOR="#ffffff" FACE="Arial"><B>GUESS MY NUMBER (1 - 100)</B></FONT></TD></TR><TR><TD><CENTER><INPUT TYPE="text" NAME="prompt" SIZE="31" MAXLENGTH="40" VALUE="Guess my number (from 1 to 100)"><BR><INPUT TYPE="text" NAME="guess" SIZE="3" MAXLENGTH="3" VALUE=""><INPUT TYPE="button" VALUE="Guess" onClick='process(guessme)'></CENTER></TD></TR></TABLE></CENTER></FORM>

I should also point out that my old kp.planet email address, has long since not been working.

 

Old old game. :o Enjoy,

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.