|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
javascript help
<html>
<head> <script type="javascript"> var message="mwahaha" function laugh(){ alert(message) } </script> <body> <form> <input type=button name="dabutton" value="click here" onclick=laugh()> </form> </body> </html> why doesnt this work? :S |
|
#2
|
||||
|
||||
|
1) message has to be inside the function
2) The script language = "javascript", not the type Code:
<html>
<head>
<script language="JavaScript">
function laugh()
{
var message="mwahaha";
alert(message);
}
</script>
<body>
<form>
<input type="button" name="dabutton" value="click here" onclick="javascript:laugh();">
</form>
</body>
</html>
|
|
#3
|
||||
|
||||
|
nice cheers!
thanks |
![]() |
| Viewing: ASP Free Forums > Programming > HTML, JavaScript And CSS Help > javascript help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|