Home > front end >  In the table form form, how is the pick up less than the value?
In the table form form, how is the pick up less than the value?

Time:10-22

The following figure, want to use js judgment of value, but how to pick up less than the value?
Is the form below and and form and js code,

 

<"Width=" 18% "& gt; <"Width=" 25% "& gt; <"Width=" 18% "& gt; <"Width=" 38% "& gt;





<script>

Var ABC=document. GetElementById (" target ");
Var b=document. GetElementById (" targetid ");
Alert (" submit failure! This is a value: "+ ABC. Value);
</script>

Values with a lot of methods:
Var ABC=form. Elements [0]. Value
Var ABC=form. The target. The value
Var ABC=document. Forms [1]. The elements [0]. Value
And so on, can't, that's really strange


I was first built a form, and then put the table in the form, this form is intuitive and clear, but the js is less than the value, depressed!

CodePudding user response:

Document. The getElementById (" targetid "). The value

CodePudding user response:

reference 1st floor cn00439805 response:
document. The getElementById (" targetid "). The value

This way I can't, that's what I do, take less than value

CodePudding user response:

 

<"Width=" 18% "& gt; <"Width=" 25% "& gt; <"Width=" 18% "& gt; <"Width=" 38% "& gt;





<script>
Alert (document. GetElementById (" targetid "). The value).
</script>

CodePudding user response:

Do you have any value, you run a negative again

CodePudding user response:

Var ABC=document. GetElementById (" target ");//not this id ABC=null
Var b=document. GetElementById (" targetid ");
Alert (" submit failure! This is a value: "+ ABC. Value);//but you lose the ABC

CodePudding user response:

Please use my code to run 3 floor, rather than you,

CodePudding user response:

Use this to see
 
Var hehe=$(" # targetid "). Val ();
Alert (hehe);

CodePudding user response:

1. No setting the value in the input value;
2. No called target id,
Var ABC=document. The getElementsByName [0] (the "target");

CodePudding user response:

For less than the value may be you get wrong time,
After you to input the content in the text box to get to,
You get when the page is loaded, access to only the initial default value,

CodePudding user response:

you get element is ABC does not mean that the input box ah how can have value

CodePudding user response:

references 9/f, the sky wave response:
get less than the value may be you get wrong time,
After you to input the content in the text box to get to,
You get when the page is loaded, access to only the initial default values,
may be so, I didn't system before contact with js, just want to use function of some statements, go back to have a try, may indeed be no ready good call

CodePudding user response:

Js code to write under the dom

And get id you code inside and no id value for the target, how can get to the value

CodePudding user response:

Closed?

CodePudding user response:

You the inside of the form on the surface of the table ID have called target or targetid? You haven't access to the object, which come of data available?

CodePudding user response:

The value? The value is to get the value of the input box, the access to the what is the value in the id use innerHTML or jquery HTML ()

CodePudding user response:

1. You take the wrong id value, you wrote this:
Var ABC=document. GetElementById (" target ");
Var b=document. GetElementById (" targetid ");
Alert (" submit failure! This is a value: "+ ABC. Value);

You alert is the value of the value of the ABC, ABC is id for targetid element, but you but you are not in the HTML, I think you should be take the input values, then you should not be in the alert is ABC. Value but b.v alue,
2. Your alert is triggered in HTML rendering is finished, at this time, the value of your input no so you get to the value of value is empty, if you want to have the value, to increase the input attribute value="https://bbs.csdn.net/topics/00" try again, or change the js

CodePudding user response:

refer to the building of small argument reply:
below, want to use js judgment value, but how to pick up less than the value?
Is the form below and and form and js code,

 

<"Width=" 18% "& gt; <"Width=" 25% "& gt; <"Width=" 18% "& gt; <"Width=" 38% "& gt;



nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related