Jump to content



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

Simple Scripts In Html And Javascript


7 replies to this topic

#1 2091

    Member [Level 3]

  • Kontributors
  • PipPipPipPipPipPip
  • 90 posts
  • Location:vienna

Posted 18 December 2006 - 10:42 AM

like in the topic, here is a description how to change the Backgroundcolor "On The Fly", by klicking on a button or radio-box

first, we ned the html-and body-tags, create a new html-file on your desktop and write the following:

Quote

<html>
<body>

<script language = "JAVASCRIPT">

</script>

</body>
</html>

browser interpretation:
html - tag means "hey, browser, here comes HTML"
in the body-tag you define the looking of your site. you can add things like "bgcolor" for the background, "text" for the textcolor and link / alink / hlink / vlink to define the linkcolor
(<body bgcolor='#000000' text='#FFA500' link='#FFA500' vlink='#FFA500'>)

the scripttag is the tag, we'll need now (sorry, but my english isn't very well)

modify your file and type in the SCRIPT - TAG:
function bgcsel(color){
document.bgColor=color;
}
this is the function, witch will change the bgcolor. now we'll type the rest, to let the function go:
write between the html tags

<input type = radio onClick = java script:bgcsel('#FFA500')>switch to Orange

<input type = radio onClick = java script:bgcsel('#FF0000')>switch to Red

<input type = radio onClick = java script:bgcsel('#000000')>switch to Black

now, when you look at the site andd klick on a radiobutton, the bgcolor will change

BTW: try to replace the "onClick" by "onMouseover"

the final file looks like this:
<html>
<body>

<script language = "JAVASCRIPT">
function bgcsel(color){
document.bgColor=color;
}
</script>

</body>
</html>

simple color changer :lol:

#2 MetalGear

    Newbie [Level 1]

  • Kontributors
  • Pip
  • 14 posts

Posted 22 December 2006 - 05:30 PM

nise thing thanks for sharing man i learn something new
thanks again

#3 Kioku

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 290 posts
  • Gender:Male
  • Location:Error 404

Posted 23 December 2006 - 05:17 AM

This could be interesting, but I have some doubts as to its usefulness.

#4 cybermandu

    Newbie

  • Kontributors
  • Pip
  • 2 posts

Posted 23 December 2006 - 08:20 AM

nice script i think this would be helpful for the webdesigners

#5 sportytalk

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 326 posts

Posted 25 December 2006 - 02:02 AM

This is a nice tutorial including some simple html and javascript scripts. As said in one of the above posts, these scripts certainly help the web designers add more dynamic content to their websites.

It is important to note though, that internet browsers allow you to disable javascript code. If your users have javascript disabled, they will not be able to see the dynamic features which you intend for them to be able to view. You need to be aware of this and ensure that there isn't too great a dependency for using Javascript.

Nice code though, will certainly help those who are looking for codes similar to the ones you have posted in this tutorial. Thanks for sharing :lol:

#6 zamaliphe

    Advanced Member

  • Kontributors
  • PipPipPipPipPipPipPip
  • 129 posts

Posted 18 October 2007 - 12:30 AM

will i thought it will be the dampest tutorials but i was wrong i learned some thing new today
thanks :P

#7 suberatu

    Advanced Member

  • Kontributors
  • PipPipPipPipPipPipPip
  • 131 posts
  • Gender:Male

Posted 20 October 2007 - 11:36 PM

It's pretty easy stuff, but useful for those who don't have any background in webcoding/design and want to be able to know how to do this kind of stuff.

#8 azri92

    Newbie

  • Kontributors
  • Pip
  • 6 posts

Posted 20 March 2008 - 09:31 AM

thanx for that post...




Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users