|
|
|
| Web Hosting Guide |
![]() ![]() |
Codes For Js, Codes For JS i have managed to pick up |
Oct 14 2007, 11:01 PM
Post
#1
|
|
|
Newbie [ Level 1 ] 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" |
|
|
|
Oct 14 2007, 11:04 PM
Post
#2
|
|
|
Newbie [ Level 1 ] 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: <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" |
|
|
|
Oct 14 2007, 11:49 PM
Post
#3
|
|
|
Techno-Necromancer 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 |
|
|
|
Jan 9 2008, 03:40 AM
Post
#4
|
|
|
Member - Active Contributor 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!!
|
|
|
|
Jul 31 2008, 01:27 PM
Post
#5
|
|
|
Advanced Member Group: [HOSTED] Posts: 121 Joined: 30-July 08 From: New Zealand Member No.: 31,753 myCENTs:NEGATIVE[-36.10] |
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. |
|
|
|
Jul 31 2008, 01:41 PM
Post
#6
|
|
|
Advanced Member Group: [HOSTED] Posts: 121 Joined: 30-July 08 From: New Zealand Member No.: 31,753 myCENTs:NEGATIVE[-36.10] |
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 <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, |
|
|
|
![]() ![]() |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
2 | Feelay | 459 | 9th December 2009 - 01:26 PM Last post by: wutske |
|||
![]() |
4 | Sarah81 | 13,231 | 8th December 2009 - 06:29 AM Last post by: iG-Sandy McNeil |
|||
![]() |
2 | kxrain | 19,767 | 1st September 2008 - 12:35 PM Last post by: Guest |
|||
![]() |
0 | rahulappe | 2,970 | 1st August 2008 - 08:48 AM Last post by: rahulappe |
|||
![]() |
7 | Jaskaran | 1,621 | 23rd April 2007 - 12:20 AM Last post by: jlhaslip |
|||
![]() |
1 | demolaynyc | 919 | 20th December 2006 - 07:26 PM Last post by: borlafu |
|||
![]() |
5 | MOOSE | 1,634 | 5th May 2006 - 06:51 AM Last post by: jlhaslip |
|||
![]() |
0 | KovoWolf | 1,189 | 1st February 2006 - 11:22 PM Last post by: KovoWolf |
|||
![]() |
8 | evanthis | 1,617 | 28th December 2005 - 04:59 PM Last post by: chocolatxbliss |
|||
![]() |
6 | Shooting Star Haven | 1,369 | 3rd December 2005 - 02:53 AM Last post by: Shooting Star Haven |
|||
![]() |
4 | whihathac | 1,232 | 25th September 2005 - 03:49 PM Last post by: XMaster |
|||
![]() |
14 | theillestmc12 | 24,078 | 23rd August 2005 - 02:54 PM Last post by: AbyssalStalker |
|||
![]() |
6 | Auschwitz | 1,734 | 22nd August 2005 - 12:08 AM Last post by: clagnol |
|||
![]() |
1 | TheKnowledge | 1,234 | 18th July 2005 - 06:04 AM Last post by: vhortex |
|||
![]() |
4 | soleimanian | 3,869 | 21st May 2005 - 09:26 PM Last post by: L1L5H1T |
|||
|
Lo-Fi Version | Time is now: 21st March 2010 - 07:36 PM |
© 2010 AstaHost: Free Web Hosting & Technical Discussion, Free Web Hosting. a member of xisto.
Powered by Invision Board. Skin: IPB Forum Skins
Expand / Collapse Navigation



Oct 14 2007, 11:01 PM





