Reputation: 3582
What does this mean in a web form?
I took this code for a button on a webpage. I am not able to understand this. Can someone help me understand this?
<input type="submit" name="ctl00$ContentPlaceHolder1$Button8" value="View all details" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$Button8", "", true, "", "", false, false))" id="ctl00_ContentPlaceHolder1_Button8" style="color:#000066;background-color:#F2F2F2;width:98px;" />
Upvotes: 0
Views: 1027
Reputation: 944527
<input
A form control
type="submit"
That submits a form
name="ctl00$ContentPlaceHolder1$Button8"
And has a name so you can see that this control submitted the form on the server
value="View all details"
And has a value which will be sent to the server and used as text
onclick="
It has obtrusive JavaScript. This is poor style, unobtrusive JS is preferred.
javascript:
Someone has joined a cargo cult. They probably think that this means "This script is written in JavaScript", but it actually is a label. As there is no loop, it is pointless.
WebForm_DoPostBackWithOptions(
new WebForm_PostBackOptions(
"ctl00$ContentPlaceHolder1$Button8",
"",
true,
"",
"",
false,
false))
This calls a function which you haven't provided.
Note that since it is inside an attribute value delimited with "
, any "
characters have to be represented with HTML entities ("e
). This makes it hard to read, which is one of the drawbacks of using obtrusive JS.
The first argument is the name of the control, which leads me to wonder why it doesn't just use this
.
"
id="ctl00_ContentPlaceHolder1_Button8"
An id so the input can be referenced from other scripts.
style="color:#000066;background-color:#F2F2F2;width:98px;" />
Some styling that should be placed in an external stylesheet.
Upvotes: 3
Reputation: 1755
This looks like something asp.net generate, and its an ajax web form.
Upvotes: 0