try another color scheme:


Go Back   TECH6.0 > Get Techie > Programming > HTML/CSS/JavaScript


Some sweet useful JavaScripts

This is a discussion on Some sweet useful JavaScripts within the HTML/CSS/JavaScript section, part of the Programming category; Change Table Colour On MouseOver A neat little trick for changing the colour of a table row on mouseover. Paste ...

Reply
 
LinkBack (1) Thread Tools Display Modes
  1 links from elsewhere to this Post. Click to view. #1  
Old 11-04-2008, 06:31 PM
webwizzy's Avatar

Administrator
 
Name: Vinayak
Join Date: Feb 2008
Location: India
Phone: Samsung Wave
Posts: 1,116
webwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nice
Send a message via Yahoo to webwizzy
Default Some sweet useful JavaScripts

Change Table Colour On MouseOver

A neat little trick for changing the colour of a table row on mouseover. Paste the code into the body of your page. You may edit the table data as necessary.

HTML Code:
<table width="100%" border="0" cellspacing="1" 

cellpadding="3">
<tr bgcolor="#e8e8e8" onMouseOver="this.bgColor = 

'#FFBC58'"
onMouseOut="this.bgColor = '#e8e8e8'">
          <td>Tech6</td>
          <td>S60 Games/Apps</td>
          <td>OS 7,8,9 

...</td>
          <td><a 

href="http://tech6.com/forumdisplay.php?f=21"
target="_top" 

onFocus="if(this.blur)this.blur()">more...</a></td>
        </tr>
<tr bgcolor="#e8e8e8" onMouseOver="this.bgColor = 

'#FFBC58'"
onMouseOut="this.bgColor = '#e8e8e8'">
          <td>Tech6</td>
          <td>Programming Res.</td>
          <td>HTML/CSS/JS,  C/C++/VC++,  ASP/ASP.NET, 

...</td>
          <td><a 

href="http://tech6.com/forumdisplay.php?f=13"
target="_top" 

onFocus="if(this.blur)this.blur()">more...</a></td>
        </tr>
</table> 
__________________
Always TAG and SHARE your threads
Submit your site to TECH6 Directory
TECH6 on Facebook - Like Us

Would you like to Link To Us | Support TECH6 by going Premium
Know more about me at Vinayaks.com | Follow TECH6 at Twitter


Reply With Quote
  #2  
Old 11-04-2008, 06:36 PM
webwizzy's Avatar

Administrator
 
Name: Vinayak
Join Date: Feb 2008
Location: India
Phone: Samsung Wave
Posts: 1,116
webwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nice
Send a message via Yahoo to webwizzy
Default AutoTab Forms

Moves the cursor on to the next form field automatically once the current one has been completed. Useful when entering dates.

HTML Code:
Paste this in the HEAD section....

<script language="JavaScript">
//AutoTab function
var field_length=0;
function TabNext(obj,event,len,next_field) {
if (event == "down") {
field_length=obj.value.length;
}
else if (event == "up") {
if (obj.value.length != field_length) {
field_length=obj.value.length;
if (field_length == len) {
next_field.focus();
}
}
}
}
</SCRIPT>

########

Paste this in the BODY section

<form name="form1" method="post" action="">
  <input type="text" name="Day" size="2" maxlength="2"
onKeyDown="TabNext(this,'down',2)"
onKeyUp="TabNext(this,'up',2,this.form.Month)">
  <input type="text" name="Month" size="2" maxlength="2"
onKeyDown="TabNext(this,'down',2)"
onKeyUp="TabNext(this,'up',2,this.form.Year)">
  <input type="text" name="Year" size="4" maxlength="4">
  <input type="submit" name="Submit" value="Submit">
</form> 
__________________
Always TAG and SHARE your threads
Submit your site to TECH6 Directory
TECH6 on Facebook - Like Us

Would you like to Link To Us | Support TECH6 by going Premium
Know more about me at Vinayaks.com | Follow TECH6 at Twitter


Reply With Quote
  #3  
Old 11-04-2008, 06:40 PM
webwizzy's Avatar

Administrator
 
Name: Vinayak
Join Date: Feb 2008
Location: India
Phone: Samsung Wave
Posts: 1,116
webwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nice
Send a message via Yahoo to webwizzy
Default Turn Radio Buttons Into Links

This script turns radio buttons into links.. You can now also click on the text beside the radio button to opt.

HTML Code:
<script language=JavaScript>
function select(radio, value)
{
var elementnr = radio * 4 + value;
document.forms[0].elements[elementnr].checked = true;
}
</script>

<form name="Answers" action="theanswers.asp" method=post>
<input type="radio" value="1" name="answer[0]"><a
href="javascript:select(0,0);">No</a><br>

<input type="radio" value="2" name="answer[0]"><a
href="javascript:select(0,1);">Yes</a><br>

<input type="radio" value="3" name="answer[0]"><A
href="javascript:select(0,2);">Maybe</a>
</form> 
__________________
Always TAG and SHARE your threads
Submit your site to TECH6 Directory
TECH6 on Facebook - Like Us

Would you like to Link To Us | Support TECH6 by going Premium
Know more about me at Vinayaks.com | Follow TECH6 at Twitter


Reply With Quote
  #4  
Old 11-04-2008, 06:43 PM
webwizzy's Avatar

Administrator
 
Name: Vinayak
Join Date: Feb 2008
Location: India
Phone: Samsung Wave
Posts: 1,116
webwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nice
Send a message via Yahoo to webwizzy
Default JavaScript Date & Clock

A simple but nice date/time script.

Code:
<script>

var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var dayarray=new
Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new
Array("January","February","March","April","May","June","July","August","September","October","November","December")
document.write(""+dayarray[day]+", "+montharray[month]+" "+daym+","+year+"")
</script>
<span id=tick2>
</span>

<script>
<!--


function show2(){
if (!document.all&&!document.getElementById)
return
thelement=document.getElementById? document.getElementById("tick2"):
document.all.tick2
var Digital=new Date()
var hours=Digital.getHours()
var minutes=Digital.getMinutes()
var seconds=Digital.getSeconds()
var dn="PM"
if (hours<12)
dn="AM"
if (hours>12)
hours=hours-12
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
var ctime=hours+":"+minutes+":"+seconds+" "+dn
thelement.innerHTML=""+ctime+""
setTimeout("show2()",1000)
}
window.onload=show2
//-->
</script>
__________________
Always TAG and SHARE your threads
Submit your site to TECH6 Directory
TECH6 on Facebook - Like Us

Would you like to Link To Us | Support TECH6 by going Premium
Know more about me at Vinayaks.com | Follow TECH6 at Twitter


Reply With Quote
  #5  
Old 11-04-2008, 06:53 PM
webwizzy's Avatar

Administrator
 
Name: Vinayak
Join Date: Feb 2008
Location: India
Phone: Samsung Wave
Posts: 1,116
webwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nice
Send a message via Yahoo to webwizzy
Default Countdown To Specific Date

Description: Quick and easy way to countdown the days to a specific date. In this example the 11,25 sets the date to the 25th of December
(JavaScript counts months from zero (0) so 0=January through to 11 = December.

Instructions: SETTING THE DATE-- The 11,25 sets the date to the 25th of December (JavaScript counts months from zero (0) so 0=January through to 11 = December

Code:
<!--Paste this bit in the HEAD section of your HTML page-->

<SCRIPT language=JAVASCRIPT>
<!-- 
now = new Date
countdown = new Date (now.getFullYear(),11,25)
if (countdown.getTime() < now.getTime()) {
countdown.setYear(countdown.getFullYear()+1)
    }
    
        
function dayToDays(inTime) {
return (Math.floor(inTime.getTime() / (1000 * 60 * 60 * 24)))
    }
    
function daysTill(inDate) {
return dayToDays(inDate) - dayToDays(now)
    }
 -->
</SCRIPT>

<!------------- --------------->

<!--Paste this bit in the BODY section of your HTML page-->


<script language=JAVASCRIPT>
<!-- 
document.write(daysTill(countdown))
-->
</script>
 DAYS TO CHRISTMAS
__________________
Always TAG and SHARE your threads
Submit your site to TECH6 Directory
TECH6 on Facebook - Like Us

Would you like to Link To Us | Support TECH6 by going Premium
Know more about me at Vinayaks.com | Follow TECH6 at Twitter


Reply With Quote
  #6  
Old 11-04-2008, 07:19 PM
webwizzy's Avatar

Administrator
 
Name: Vinayak
Join Date: Feb 2008
Location: India
Phone: Samsung Wave
Posts: 1,116
webwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nice
Send a message via Yahoo to webwizzy
Default Button Snippets

Uses a Button to close a window

HTML Code:
<input type="button" value="Close" onclick="javascript:self.close();"> 
Uses a button to load a URL into the parent window

HTML Code:
<input type="button" value="Go" onclick="parent.location='http://tech6.com'"> 
Uses a button to load a URL in a new window

HTML Code:
<input type="button" value="Go" onclick="window.open('http://tech6.com')"> 
Uses a button to navigate forward one page

HTML Code:
<input type="button" value="Go Next" onClick="javascript:history.go(1)"> 
Uses a button to navigate back one page

HTML Code:
<input type="button" value="Go Back" onClick="javascript:history.go(-1)"> 
Uses a button to send an email

HTML Code:
<input type="button" value="Send me an email" onclick="parent.location='mailto:youremail@email.com'"> 
Uses a button to print the current window

HTML Code:
<input type="button" value="Print" onclick="javascript:window.print()"> 
Uses a button to make this site your Homepage.

HTML Code:
<input type="button" value="Make This Site Your Home Page" onClick="this.style.behavior='url(#default#homepage)'; this.setHomePage('http://tech6.com');"> 
Uses a button to add site to Bookmark/Favorites

HTML Code:
<input type="button" value="Add to Favorites" onClick='window.external.AddFavorite(location.href, document.title);'> 
Uses a button to display Source Code of the webpage

HTML Code:
<input type="button" value="View Source" onClick= 'window.location = "view-source:" + window.location.href' > 

Note:- Some of the above snippets would work just for IE.

__________________
Always TAG and SHARE your threads
Submit your site to TECH6 Directory
TECH6 on Facebook - Like Us

Would you like to Link To Us | Support TECH6 by going Premium
Know more about me at Vinayaks.com | Follow TECH6 at Twitter


Reply With Quote
  #7  
Old 11-04-2008, 10:25 PM
webwizzy's Avatar

Administrator
 
Name: Vinayak
Join Date: Feb 2008
Location: India
Phone: Samsung Wave
Posts: 1,116
webwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nice
Send a message via Yahoo to webwizzy
Default Prevent your site from being Framed

If you've ever discovered that someone has linked to your web site within a frame, which means your site is stuck in their frame with their information displaying within another frame, you know how frustrating this can be. You want your visitors to visit your web site within their standard browser window - not within another web site's frame. The following JavaScript code will enable you to prevent your web site from being framed.

Add the following onLoad attribute to your <body> tag:

HTML Code:
<body onLoad="if (self != top) top.location = self.location"> 
__________________
Always TAG and SHARE your threads
Submit your site to TECH6 Directory
TECH6 on Facebook - Like Us

Would you like to Link To Us | Support TECH6 by going Premium
Know more about me at Vinayaks.com | Follow TECH6 at Twitter


Reply With Quote
  #8  
Old 20-05-2008, 09:53 AM
iBlake's Avatar

Techie
 
Name: Blake
Join Date: May 2008
Location: United States
Phone: Not in the list
Posts: 91
iBlake is on a distinguished road
Send a message via MSN to iBlake
Default

Thanks, I am using all of them in my new website.
__________________
My iPhone is better than yours...........

I Am Back!
Reply With Quote
  #9  
Old 03-05-2010, 10:51 AM
No Avatar

Learner
 
Name: Mandar
Join Date: Oct 2009
Location: India
Phone: Nokia N95 8GB
Posts: 19
Mandar Salvi is on a distinguished road
Default

Thank you so much. Please keep posting
Reply With Quote
Reply

Bookmarks


Thread Tools
Display Modes


LinkBacks (?)
LinkBack to this Thread: http://tech6.com/f14/some-sweet-useful-javascripts-t86/
Posted By For Type Date
Background Hover color - vBulletin.org Forum This thread Refback 25-07-2009 08:46 PM



All times are GMT +5.5. The time now is 01:39 AM.

Contact Us - Tech6.com - Link to Us - Advertise - Submit Site - Privacy Statement - TOS - Top