Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Codes For Js, Codes For JS i have managed to pick up
blackhand101
post Oct 14 2007, 11:01 PM
Post #1


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 6
Joined: 14-October 07
Member No.: 25,520



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"
Go to the top of the page
 
+Quote Post
blackhand101
post Oct 14 2007, 11:04 PM
Post #2


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 6
Joined: 14-October 07
Member No.: 25,520



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"
Go to the top of the page
 
+Quote Post
vizskywalker
post Oct 14 2007, 11:49 PM
Post #3


Techno-Necromancer
Group Icon

Group: Members
Posts: 1,018
Joined: 13-January 05
From: The Net
Member No.: 2,127



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
Go to the top of the page
 
+Quote Post
kxrain
post Jan 9 2008, 03:40 AM
Post #4


Member - Active Contributor
Group Icon

Group: Members
Posts: 87
Joined: 9-January 08
Member No.: 27,482



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!!
Go to the top of the page
 
+Quote Post
Lancer
post Jul 31 2008, 01:27 PM
Post #5


Member [ Level 2 ]
Group Icon

Group: [HOSTED]
Posts: 60
Joined: 30-July 08
From: New Zealand
Member No.: 31,753



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.
Go to the top of the page
 
+Quote Post
Lancer
post Jul 31 2008, 01:41 PM
Post #6


Member [ Level 2 ]
Group Icon

Group: [HOSTED]
Posts: 60
Joined: 30-July 08
From: New Zealand
Member No.: 31,753



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,
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. http errors codes(4)
  2. Protect Your Codes(18)
  3. Help Me Pick(11)
  4. Handling Keyboard Input In Win32(2)
  5. Cool Codes For Html/css Guys?(14)
  6. Poll: Which Is The Best Os(50)
  7. Time To Pick On An Admin (my Website)(2)
  8. Add More Icons/Smilies And Make Codes For Them(1)
  9. The Sco Group Failed To Produce Any Evidence That(1)
  10. For Those Who Know Their Html Codes(6)
  11. Where To Get Free Itunes Codes?(0)
  12. Opera 8.5 Free Reg Codes!(4)
  13. Best Games Of All Time(5)
  14. Testing Application Codes(6)
  15. Where Can I Learn Html Codes ?(8)
  1. Linux Distribution Chooser(10)
  2. How Small Can Linux Be?(15)
  3. {} Html'ing & Basic Codes {}(0)
  4. Dynamicdrive: Good Site For JavaScript Codes(5)
  5. Choosing A Linux Distro. Why Should I Pick Yours?(10)
  6. Free Source Codes For C++(1)
  7. A Tutorial For Html Color Codes(7)
  8. Mp3 Codes For Myspace & Friendster(2)
  9. Tracing Broadcast Storms(1)
  10. Common Ftp Server Error Codes(0)
  11. Question About Opengl Codes.(0)
  12. Second Generation Microsoft, Google, And Pick The Cat Captchas Broken(4)


 



- Lo-Fi Version Time is now: 12th October 2008 - 09:29 AM