...

View Full Version : new to this (prompts)



olpray
01-09-2007, 08:21 PM
Im so new to this, i have a book ect, but am struggling, i need to get a prompt up when i click a button, can anyone help, basic i know but im stuck

ImperialSpider
01-09-2007, 08:32 PM
what type of button, and what do you want the prompt to say, or do?

Imperial Spider

olpray
01-09-2007, 09:12 PM
well basically i want a prompt to appear when the button is pressed with text saying enter a city below or summit like that, i can do the rest i think lol, i just cannot get the damn button to open a prompt

ImperialSpider
01-09-2007, 09:44 PM
<input type="button" value="Submit" onClick="alert('You forgot to enter a City.');">



Hope this is what you are looking for.

Imperial Spider

Philip M
01-09-2007, 09:49 PM
<Script type = text/javascript>
function getName() {
var city = prompt ("Please enter the name of a city.....", "");
if (city.length<4) { // ensures city name at least 4 characters length
city = prompt ("Please try again.....", "");
if (city.length <4) {
getName(); // go round again until a valid response is given
}
}
}
</script>

<Input type = "button" name= "button1" value = "Enter your city" onclick="getName()">

Do please write English. There is no need to advertise poor literacy.

olpray
01-09-2007, 09:51 PM
thanks for the help, perfect!
cheers dude



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum