FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Javascript working in IE but not Firefox. Why?

 


Dougie1
I have tried getting this javascript to work in firefox but it just wont. Is there a reason and is there a way to sort it?

Code:
<form name="MyForm" method="POST" action="display.php">
<input type="hidden" name="ThisPageURL" value="">
<input type="hidden" name="TimeZoneOffset" value="">
</form>


<script type="text/javascript" language="JavaScript"><!--
document.MyForm.ThisPageURL.value = document.URL;
var visitortime = new Date();
document.MyForm.TimeZoneOffset.value = visitortime.getTimezoneOffset();
document.MyForm.submit();
//--></script>
Esch
Assign unique ids to your form elements and use document.getElementById('id_of_element') to retrieve objects from your page; the style of directly going document.id is poorly supported.

In general, it's a better idea to use document.getElementById() than the many other styles of retrieving object handles that're out there.
mariohs
That's correct. Try to use methods like getElementById, getElementsByName, getElementsByTagName...
Just be careful that the first one returns an object and the last two return an array of objects.
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.