IE does not read the value of a real button! How to get around this?

I have a button tag that should be used, and enter a tag that has different text, and what should I do, see below.

<button value="<%=RS("field1")%>" name="change" id="change">Change</button>

This works dandy in Firefox, but in IE .. dun, dun, dunnnn ... the button value is returned as the word "change", which is for the text displayed by the button.

I would normally use and enter a tag, but I think I can use a button tag

Is there any way around this?

+3
source share
6 answers

From w3schools.com :

: HTML, . Internet Explorer <button> </button>, value. HTML.

, <input type="button" />

+6

, , name,

<button name="change:<%=RS("field1")%>" id="change:<%=RS("field1")%>">Change</button>

, , {, ).

( , .)

+3

, . , IE , .

, , , ?

<form action="somepage" method="POST">
    <!-- some fields here -->
    <input type="hidden" name="action" value="<%=RS("field1")%>" />
    <button name="change" id="change">Change</button>
</form>
+2

, "" ( ), :

<button ... onclick="this.innerHTML=this.value;" ... >
+1

IE8 , IE7 (, 6 , ).

, , , , ( JavaScript) .

:

<button value="<%=RS("field1")%>" name="change" onclick="this.innerHTML = this.childNodes[1].innerHTML;"><span>Change</span><span style="display: none;"><%=RS("field1")%></span></button>

Also, since you have this in a loop, don’t set an identifier so as not to have more than one element sharing the same identifier β€” it is not valid, and if you need an identifier for any reason, add something unique to him at every iteration.

0
source

As I said above, do not check the value in the {button_name, button_value} pair, but instead check only the name_name in the input, without checking its value.

0
source

Source: https://habr.com/ru/post/1780437/


All Articles