rgksugan
rgksugan

Reputation: 3582

What does this mean in a html form?

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(&quot;ctl00$ContentPlaceHolder1$Button8&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" id="ctl00_ContentPlaceHolder1_Button8" style="color:#000066;background-color:#F2F2F2;width:98px;" />

Upvotes: 0

Views: 1027

Answers (2)

Quentin
Quentin

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(
        &quot;ctl00$ContentPlaceHolder1$Button8&quot;, 
        &quot;&quot;, 
        true, 
        &quot;&quot;, 
        &quot;&quot;, 
        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 (&quote). 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

Gary Tsui
Gary Tsui

Reputation: 1755

This looks like something asp.net generate, and its an ajax web form.

Upvotes: 0

Related Questions