[Sussex] Make IE 7 crash

Brendan Whelan b_whelan at mistral.co.uk
Thu Jan 31 18:34:39 UTC 2008


Here is the (untested) code anyway:

<input type="hidden" name="add_file_num" value="0">

<button onclick="doSubmitAddNum(999);" class="formButton" 
name="add_image_1_button">Add image</button>

<script language ="javascript" type="text/javascript">
function doSubmitAddNum(num)
  {
alert('In doSubmitAddNum');
document.form1.add_file_num.value=num;
document.form1.submit();
  }
</script>

Always ensure the field (add_file_num in this case) is defined as a 
hidden input. I left the alert in the code as I have found it very 
useful. If the alert message appears but the form doesn't get submitted 
then the chances are that the "hidden" value isn't defined.

Brendan

Brendan Whelan wrote:
> A technique I use for setting a specific number when a button is 
> pressed is to use "onclick" and a bit of javascript.
> The javascript sets the value and then issues a submit. I use this 
> technique when I have loops within pages and want to identify (for 
> example) which Save button was pressed.
> I will send an example if anyone is interested.
>
> Brendan
> Vicky Lamburn wrote:
>> Hi Steve,
>>
>> There's a couple of reasons I steer clear of <input type="submit" ...>
>> - it's poor for CSS styling as if you use input submit on Safari for
>> example, you cannot set the width and height of the button as it uses
>> the aqua glow button look, where as <button> by default gives all
>> browsers and all platforms a regular bland grey button which is ideal
>> as a starting point to style with CSS.
>>
>> You can also use other tags within a button tag such as images and so
>> forth so you can do some very nice things e.g.:
>>
>> http://particletree.com/features/rediscovering-the-button-element/
>>
>> The reason I can't use <input type="submit" is not just aesthetics in
>> this instance. On the page due to the code in the background I have to
>> register a numeric value (a database record ID) and pass it using a
>> button, as such if I used
>>
>> <input type="submit" id="submitButton" name="submitButton"
>> value="579">Approve Changes</input>
>>
>> The button would not be labeled Approve Changes but would be called
>> '579' - which wouldn't help.
>>
>> It's hard to explain this in words without examples and this is a
>> fairly unique situation that after 12 years of writing web pages and
>> so forth, this is the first time that I have needed to pass a value
>> through the submit button itself and the HTML 4.0 value <button> is
>> the only way of doing that.
>>
>> Of course IE's implementation is all wrong, just like IE6's box object
>> model makes about as much sense as I do after about two bottles of
>> wine :)
>>
>> Vicky
>>
>> __ Sussex mailing list
>> Sussex at mailman.lug.org.uk
>> E-mail Address: sussex at mailman.lug.org.uk
>> Sussex LUG Website: http://www.sussex.lug.org.uk/
>> https://mailman.lug.org.uk/mailman/listinfo/sussex
>>
>>
>>   
>
>
> __ Sussex mailing list
> Sussex at mailman.lug.org.uk
> E-mail Address: sussex at mailman.lug.org.uk
> Sussex LUG Website: http://www.sussex.lug.org.uk/
> https://mailman.lug.org.uk/mailman/listinfo/sussex
>
>





More information about the Sussex mailing list