Link to home
Start Free TrialLog in
Avatar of technoparkcorp
technoparkcorpFlag for United States of America

asked on

Opera onclick defect in JS?

Why this code doesn't work in Opera? And it works in all other browsers (IE, FF)

When the user clicks the button nothing happens. Why so?
<form>
<input id="continue" type="button" value="Continue" onclick="ToContinue();" />
</form>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of agriesser
agriesser
Flag of Austria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Kin Fat SZE
Kin Fat SZE
Flag of Hong Kong image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of technoparkcorp

ASKER

This snippet works fine in all browsers.

When I move the function to the script file, it doesn't work. What's wrong?
<html><body>
<form>
<input id="continue" type="button" value="Continue" onclick="ToContinue(); return false;" />
</form>
<span id="test">old</span>
<script type='text/javascript'>
<!--
function ToContinue () {
	document.getElementById ('test').innerHTML = 'new';
}
-->
</script>
</body></html>

Open in new window

why? What's wrong?
there a space between getElementById ('test')
                                                      ^



 
<html><body>
<form>
<input id="continue" type="button" value="Continue" onclick="ToContinue(); return false;" />
</form>
<span id="test">old</span>
<script type='text/javascript'>
<!--
function ToContinue () {
        document.getElementById('test').innerHTML = 'new';
}
-->
</script>
</body></html>

Open in new window

Can you show the JS file and the html you ACTUALLY use?

Also you should comment out inline html comments in JS
Like this:

// -->