PDA

View Full Version : I can't find anythign wrong with this javascript, yet it fails.


Remember
01-28-2009, 05:53 PM
<html>
<head>
<script type="text/javascript">
function myfunction(txt)
{
alert(txt);
}
</script>
</head>

<body>
<form>
<input type="button"
onclick="myfunction('You've chosen a Ladder match')"
value="Ladder">

<input type="button"
onclick="myfunction('You've chosen Custom match')"
value="Custom">
</form>

<p>
When you click on one of the buttons, a function will be called. The function will alert
the argument that is passed to it.
</p>

</body>
</html>






Buttons wont work, I followed a tutorial exactly.
To the freakin' T.



EDIT: AHA! NVM, I foudn out in the alert box I cannot have a "'", as in "you've", it ended it, but still had words after it, so it screwed it up, LOCK PL0X.

Neo
01-29-2009, 12:21 AM
EDIT: AHA! NVM, I foudn out in the alert box I cannot have a "'", as in "you've", it ended it, but still had words after it, so it screwed it up, LOCK PL0X.

You can escape the apostrophe's like this: 'You\'ve selected a ladder match.'77

Remember
01-29-2009, 12:31 AM
You can escape the apostrophe's like this: 'You\'ve selected a ladder match.'77
Oh, thanks! :D