View Full Version : More Help!!!!
deffa
06-05-2006, 07:44 PM
<SCRIPT>
function getname(){
//this is the name of the function
var thiscookie=document.cookie;
//this retrieves the cookie
var location=thiscookie.indexOf("surfername=");
//this is the location of where the information starts
var endlocation=thiscookie.indexOf(":");
//this is the location of the end of the information
if (location != -1){
//this checks to see if the cookie exists
var begin=location+11;
//this gets the location of the begining of the surfer's name
var yourname=thiscookie.substring(begin, endlocation);
//this grabs the value from the cookie
yourname = unescape(yourname);
//this unencodes the surfer's name
return yourname;
//this returns the surfer's name
}
else{
var yourname = prompt("Welcome, please enter in your name.",'');
//this asks for the name
document.cookie = "surfername=" + escape(yourname)+":" + "expires=Fri Dec 10 11:00:00 PST 1999";
// the above line sets the cookie with a name=value pair of surfername=value
// you may modify the expiration date by changing the expires=
}
return yourname; //this returns the surfer's name
}
</SCRIPT>
part to of the script
<SCRIPT>
document.write("Welcome to my site, " + getname() + "!");
</SCRIPT>
hey how can i change the font colour and font size in this script...
he he he he..
guys i have no idea about this.. he he he he.. im not in the web developing.. sorry guys...
deffa
06-05-2006, 08:42 PM
machang lich i contact u if i get a pob abt music...mixin..ela ne.....hehe
deffa
06-06-2006, 12:02 AM
machang GTRZ i think i need your help on this as well...thank u
Script not complete so can’t say, anyway you looking for a java script which ask for the name using a small popup then you can’t change the colour coz it’s coming from the browser.
Tell me what you wanna do?
deffa
06-06-2006, 12:12 AM
Script not complete so can’t say, anyway you looking for a java script which ask for the name using a small popup then you can’t change the colour coz it’s coming from the browser.
Tell me what you wanna do?
which ask for the name using a small popup.
and to display it sumwher in the page da name
================================================== ==========
Script: Ask Visitor For Name Script
Functions: A very simple paste-it-in script that asks the
vistor for his or her name when entering your
page, then prints a "Hello" welcome message
anywhere you wish in the body of the page.
If the visitor does not type in a message,
a default message shows, instead. Very easy
install for JavaScript newcomers.
Browsers: NS3-6, IE4-6
Author: etLux
================================================== ==========
INSTRUCTIONS:
Paste the following <script> ... </script> block into the
<body> (notice we said the body, *not* the <head>) of
your page, exactly where you would like the message to
appear.
<script>
var whatName=prompt("Please type in your name:","");
function doName(theName){
if ((whatName != "")&&(whatName !=null)){
// you can modify this as needed
// this is the message if a name is typed in
document.writeln("Hello "+whatName+"!")
}else{
// you can modify this as needed
// this is the message if a name is *not* typed in
document.writeln("Hello!")
}
}
doName(whatName);
</script>
================================================== ==========
Design Notes:
1.
When you use an in-the-body script like this, you will
usually want to format the text it prints into the page.
This is simple enough to do -- just surround the the
<script> ... </script> block with font tags, like this:
<font face="Arial" size="2" color="#FF0000">
<script>
.
.
.
</script>
</font>
Change the face, size, and color to match your design.
2.
You may not, of course, want to use the "Hello Name!"
message we show. See the two commented lines in the script
above for where you can change the message.
================================================== ==========
hope this helps, you can change the colour, font, size everything in this.. :yes:
azaamDAsquad
06-06-2006, 01:14 PM
did this work.. deffa. ..
TELL US... :D
deffa
06-06-2006, 02:09 PM
<SCRIPT>
document.write("Welcome to my site, " + getname() + "!");
</SCRIPT>
the above was the secont part of my original script.. all i had to do is
add
<font face="Arial" size="2" color="#FF0000">
<script>
.
.
.
</script>
</font>
the full script wud..be (secind part of my script
<font face="Arial" size="2" color="#FF0000">
<SCRIPT>
document.write("Welcome to my site, " + getname() + "!");
</SCRIPT>
</font>
the font part to it wel i trid that in front page and it workd i will be addin it to my site to nite which is http://www.deffa12e.tk
plese tel me how it is..
deffa
06-06-2006, 02:12 PM
this is what GRTZ gave me
<script>
var whatName=prompt("Please type in your name:","");
function doName(theName){
if ((whatName != "")&&(whatName !=null)){
// you can modify this as needed
// this is the message if a name is typed in
document.writeln("Hello "+whatName+"!")
}else{
// you can modify this as needed
// this is the message if a name is *not* typed in
document.writeln("Hello!")
}
}
doName(whatName);
</script>
same as above jus had to add the font part
the final script luks like
<font face="Arial" size="2" color="#FF0000">
<script>
var whatName=prompt("Please type in your name:","");
function doName(theName){
if ((whatName != "")&&(whatName !=null)){
// you can modify this as needed
// this is the message if a name is typed in
document.writeln("Hello "+whatName+"!")
}else{
// you can modify this as needed
// this is the message if a name is *not* typed in
document.writeln("Hello!")
}
}
doName(whatName);
</script>
</font>
wel both of the scripts worked...thanks GTRZ
vBulletin v3.5.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.