25. How to upload files using HTML to website?
The uploading of files requires some necessary configuration like:
An HTTP server that acts as a transaction between the user and the server.
Access to the directory of cgi-bin that consists of the receiving script. There
are some scripts that are already available.
Form for the implementation and the coding of it will be like:
<form method="post" enctype="multipart/form-data" action="up.cgi">
The form that has to be uploaded will be done by the following given code:
<input type=file name=upload><br>
This tag will contain the file name that has to be uploaded on the website.
Any remarks about the file will be written like:
<input type=text name=remark><br>
<input type=submit value=Press> This form will allow user to upload their
own file in an easy way.
</form>
There is a module named as Perl CGI.pm that supports the file upload.
26. Write a program to include the custom button with the form
Custom button can be given just by putting the image with the button or by using
any other button then normal. Usually the button is being made by the
<input> tag like:
<input type= “submit” value= submit>
An image can be used for the custom button as an input type like:
<input type = ”image” value = submit>
The input in the image format defines the graphical button that has to be
placed in the form of submit on the web site. Image input type return the x-y
coordinates rather than the normal text as a value. The attributes of Value and
Alt will be used to set the name value attribute. The example for the same will
be given as:
<input type="image" name="submit" alt="submit" value="submit"
src="submit.jpg">
27. How to prevent the display of “Getting framed in HTML?
Getting framed refers to the document that is being displayed in someone else's
frameset in your HTML. This will be password protected and the permissions has
to be taken before inserting the frameset. The framing of the document can be
avoided by using TARGET=_top applied to all the links that will lead to the
document that are outside the scope of a particular user without permission. A
javaScript can be used that will automatically handle the request to remove the
existing framesets. This can be given as:
<script type="text/javascript">
if (top.frames.length!=0) {
if (window.location.href.replace)
top.location.replace(self.location.href);
else
top.location.href=self.document.href;
}
</script>
28. How to include a frameset inside another frameset?
One frameset can be defined inside another frameset if the accessing permission
are provided directly. The frameset can be stored by using the JavaScript in
the document that is being written by the user and the script is as follows:
<SCRIPT TYPE="text/javascript">
if (parent.location.href == self.location.href) {
if (window.location.href.replace)
window.location.replace('frame.html');
else
// causes problems with back button, but works
window.location.href = 'frame.html';
}
</SCRIPT>
The anchor <a> tag is used to link the frameset that can be used to
restore the frames that has been stored.
<A HREF="frameset.html" TARGET="_top">Restore the frame
There is always a separate frameset document written for every content
document. The frameset documents are generated automatically. The content
document can be linked separately rather than linking them together.
30. How to update two frames at the same time using HTML?
To update the two frames at the same time there is a requirement for the HTML
based techniques that links the documents with a new frameset document. It
specifies a new frames that can be combined with other frames. There is a
JavaScript that will be used to link the updated frame and the method that will
be used is onClick(). HTML based technique allow the new frameset document with
the attribute of TARGET=_top. In this the first frameset document uses a
secondary frameset document that will be defined as the nested frameset. The
following code explains it further:
<frameset cols="*,3*">
<frame src="first.html" name="first_frameset">
<frame src="second.html" name="sec_frameset">
<noframes>
</body></noframes>
</frameset>
The link that is given in the TARGET= “sec_frameset” attribute it replaces all
the frames that is defined as second.html.
|