Say I have a variable called "true" in a function called "test." Then I have another function in a whole different script tag and I want to change "true" using my new function. How can I do this? Thanks.
<script type="text/javascript">
var hello="no";
if(hello=="yes"){
window.onbeforeunload = confirmExit;
function confirmExit()
{
return "Message";
}
}
</script>
<script type="text/javascript">
function show(id) {
$('#' + id).show();
var hello="yes";
}
</script>
It doesnt seem to be working...
varat a higher scope than the functions that use it. Post your code and we can help. Without code, we cannot.trueis a reserved word and can't be used for a variable name. It would be nice to see what you're doing.var true; function f1() {true = 'hi';} function f2() {true = "something else";}