Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Gloogle Chlome

Name: Anonymous 2009-09-14 23:45

Cool thing:


<form name="formy">
<textarea name="display" rows="20" columns="20">LOL:</textarea>
<button name="whatever" onClick="document.formy.display.value = document.formy.display.value + '\nwhatever';">whatever</button>
</form>


This works as expected in IE, but not Chrome or Firefox

Name: Anonymous 2009-09-15 14:01

By the way, document.form.element.value is not the right way to access an element. You should use DOM instead. name attribute on form HTML elements is deprecated and not allowed on XHTML Strict, but still used on form elements as it's the "variable name" passed on POST/GET.

<script type="text/javascript">
  function $(id) { return document.getElementById(id); }
</script>
<form id="formy">
  <textarea name="display" id="formy_display" rows="20" columns="20">LOL:</textarea>
  <button type="button" id="formy_whatever" onclick="$('formy_display').value = $('formy_display').value + '\nwhatever'">whatever</button>
</form>

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List