Jump to content



Welcome to AstaHost - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!

Toggle shoutbox Shoutbox Open the Shoutbox in a popup

@  yordan : (14 April 2014 - 05:28 PM) By The Way, This Could Be An Interesting Subject For A Topic, What About Posting This Question? Let's See If Other People Have The Same Feeling Concerning Bootlists!
@  yordan : (13 April 2014 - 09:36 AM) Boot Order : Cd, [Usb,] Hard Drive :D
@  yordan : (11 April 2014 - 07:23 PM) I Simply Let The Bios Do That
@  Ritesh : (11 April 2014 - 10:23 AM) Is It Possible To Launch Fedora Live Cd Or Installation Disk From Hard Drive On Windows Platform Using Grub Mbr File.
@  Ritesh : (11 April 2014 - 10:21 AM) No U Are Not.. Btw.. I Have Question For You.
@  yordan : (10 April 2014 - 08:02 AM) You Are Partially Right.
I Was Not.
Nevertheless, I Am Again :)
@  Ritesh : (09 April 2014 - 07:33 PM) :P
@  Ritesh : (09 April 2014 - 07:33 PM) I Think U R Not..
@  yordan : (09 April 2014 - 09:28 AM) I'm The Master Of The Shoutbox!
@  yordan : (05 April 2014 - 10:32 PM) He-He
@  Ritesh : (04 April 2014 - 06:59 PM) Ha Ha Ha ....
@  yordan : (04 April 2014 - 11:15 AM) Welcome Back, Starscream!
@  yordan : (03 April 2014 - 02:31 PM) And I Hope That He Will Come Back Soon :)
@  yordan : (01 April 2014 - 02:53 PM) Nice, Ritesh Came, I'm Not Home Alone Today.
@  Ritesh : (01 April 2014 - 08:51 AM) Oh!!! Poor Dear Yordan..
@  yordan : (31 March 2014 - 10:02 AM) I'm A Poor Lonesome Cow-Boy
@  yordan : (27 March 2014 - 02:22 PM) He Is Unpatient Due To His Patients!
@  Ritesh : (27 March 2014 - 10:46 AM) :(
@  Ritesh : (27 March 2014 - 10:46 AM) He Is Busy With His Patients.
@  yordan : (26 March 2014 - 08:12 PM) Ahsani, Where Are You?

Photo
- - - - -

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


5 replies to this topic

#1 blackhand101

blackhand101

    Newbie [ Level 1 ]

  • Members
  • 6 posts

Posted 14 October 2007 - 11:01 PM

here is one code i will post another


<script LANGUAGE="JavaScript">
<!--

// Use these three variables to set the message, scroll speed and start position
var msg = "Your Message Here"  //This is the message that will appear in the status bar.
var delay = 128   //increase to slow down movement
var startPos = 130   //increase to move start position to the right

// Don't touch these variables:
var timerID = null
var timerRunning = false
var pos = 0

// Make it all work
Scrollit()

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"

#2 blackhand101

blackhand101

    Newbie [ Level 1 ]

  • Members
  • 6 posts

Posted 14 October 2007 - 11:04 PM

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:&nbsp;&nbsp;&nbsp;<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"

#3 vizskywalker

vizskywalker

    Techno-Necromancer

  • Members
  • 1,018 posts
  • Location:The Net

Posted 14 October 2007 - 11:49 PM

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

#4 kxrain

kxrain

    Member - Active Contributor

  • Members
  • 87 posts

Posted 09 January 2008 - 03:40 AM

yes this are useful codes for my site. I will try to used this one if I build another site again. Thanks for the script dude!!

#5 Lancer

Lancer

    Advanced Member

  • [HOSTED]
  • 121 posts
  • Gender:Male
  • Location:New Zealand
  • Interests:3D Animation, Linux, Education
  • myCENTs:NEGATIVE[-36.10]

Posted 31 July 2008 - 01:27 PM

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.javascrip...ipt/cut97.shtml... I think they may have called themselves "JavaScript Source" when I originally submitted the code.

#6 Lancer

Lancer

    Advanced Member

  • [HOSTED]
  • 121 posts
  • Gender:Male
  • Location:New Zealand
  • Interests:3D Animation, Linux, Education
  • myCENTs:NEGATIVE[-36.10]

Posted 31 July 2008 - 01:41 PM

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.javascrip.../ageguess.shtml

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

&lt;script LANGUAGE="JavaScript">
<!--;
// numberguess is by Lancer - written 4 Jan 1999
// lancer@kp.planet.gen.nz

var 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,



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users