Nov 22, 2009

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

free web hosting
Open Discussion & Free Web Hosting > Computers & Tech > Designing

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

blackhand101
here is one code i will post another


CODE
<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"

 

 

 


Comment/Reply (w/o sign-up)

blackhand101
this next one is not really js but php sendmail code

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"

 

 

 


Comment/Reply (w/o sign-up)

vizskywalker
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

Comment/Reply (w/o sign-up)

kxrain
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!!

Comment/Reply (w/o sign-up)

Lancer
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.

CODE
<!--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.

Comment/Reply (w/o sign-up)

Lancer
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)

CODE
&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>
CODE
<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,

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : Codes Js Codes Js Managed


    Looking for codes, js, codes, js, managed, pick

See Also,

*SIMILAR VIDEOS*
Searching Video's for codes, js, codes, js, managed, pick
advertisement



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

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com