In Feburary 2016 28,
Open a text editor and create a new file named 'changeTextVars.html.' Type six HTML tags in the file:
Save 'changeTextVars.html.'
Place a JavaScript open script tag -- '' tag:
Add a JavaScript function between the '' tags named 'changeText().' The 'changeText()' function takes a variable named 'monsterName' as an argument:
Edit the 'changeText' function. Use the 'document.getElementById' function to change the 'innerHTML' property for the field named 'textToChange.' The 'textToChange' field holds the text updated with the variable 'monsterName':
Add a '' tag between the HTML '
' and '
' tags. Enter some text that displays the message -- such as 'My favorite monster is: ' -- and close the '' tag. Be sure to include a space after the colon and before the '' tag to separate the message from the dynamic text:
My favorite monster is:
Enter an open '' tag between the '' and '' tags after the 'My favorite monstor is: ' message. Assign an 'id' to the '' tag and set its value to 'textToChange.' For example, type the text 'Dracula' after the '' tag and close the '' tag:
My favorite monster is:
Dracula
Add an HTML '
' tag after the '' tag. Set the input type to 'button' and add an 'onclick()' event that calls the 'changeText' function and passes the value 'Frankenstein.' Set the input field 'value' attribute to 'Change Text.' Save and close 'changeTextVars.html.'
My favorite monster is:
Dracula
Open 'changeTextVars.html' in a Web browser. Click the 'Change Text' button to use the 'monsterName' variable to change the 'textToChange' field from 'Dracula' to 'Frankenstein.'
In Feburary 2016 28,
Showing posts with label variable. Show all posts
Showing posts with label variable. Show all posts
Sunday, 28 February 2016
Tuesday, 23 February 2016
How to Format Date Parameters in SQLIn Feburary 2016 23,
In Feburary 2016 23,
Create a new query statement in SQL to extract a date from the database. However, instead of extracting the raw data value stored in the database, use the 'Date_Format' command in conjunction with the query to ensure the extracted date is in your desired format.
Enter the name of the database variable that represents the raw date value as the first parameter in the 'Date_Format' command. This command uses two parameters separated by a comma inside the command's parenthesis. The format is 'Date_Format(date, format)'.
Identify the SQL date format codes that represent the many date formats that SQL may output. These codes cover all conceivable date formats and may be arranged in any order. Each code begins with a percent sign and is followed by a letter which represents a portion of a date displayed in a particular fashion. For example, '%Y' is the four-digit year, while '%y' is the two-digit year.
Format the second parameter of the 'Date_Format' command using SQL date codes to match the desired output format of the date that is extracted from the database. For example, to create a verbose text output of the date, use '%W, %M %e, %Y'. This date format will appear as 'Sunday, April 18, 2010'. Commas are entered in the format where they should appear in the final output.
Format the date as a numerical string by typing 'Date_Format([date],'%e-%c-%Y')'. Note that the single quotes are not included in the actual typed SQL query. Use the actual name of the database variable for '[date]' in this example. The output will resemble '18-4-2010'.
In Feburary 2016 23,
Create a new query statement in SQL to extract a date from the database. However, instead of extracting the raw data value stored in the database, use the 'Date_Format' command in conjunction with the query to ensure the extracted date is in your desired format.
Enter the name of the database variable that represents the raw date value as the first parameter in the 'Date_Format' command. This command uses two parameters separated by a comma inside the command's parenthesis. The format is 'Date_Format(date, format)'.
Identify the SQL date format codes that represent the many date formats that SQL may output. These codes cover all conceivable date formats and may be arranged in any order. Each code begins with a percent sign and is followed by a letter which represents a portion of a date displayed in a particular fashion. For example, '%Y' is the four-digit year, while '%y' is the two-digit year.
Format the second parameter of the 'Date_Format' command using SQL date codes to match the desired output format of the date that is extracted from the database. For example, to create a verbose text output of the date, use '%W, %M %e, %Y'. This date format will appear as 'Sunday, April 18, 2010'. Commas are entered in the format where they should appear in the final output.
Format the date as a numerical string by typing 'Date_Format([date],'%e-%c-%Y')'. Note that the single quotes are not included in the actual typed SQL query. Use the actual name of the database variable for '[date]' in this example. The output will resemble '18-4-2010'.
In Feburary 2016 23,
Labels:
desired,
Enter,
format,
formats,
parameter,
parameters,
represent,
represents,
separated,
variable
Thursday, 18 February 2016
How to Get TD Class Value in JqueryIn Feburary 2016 18,
In Feburary 2016 18,
Open the Web page in Notepad or a code editor, and look for the jQuery library file. If your code contains no reference to this file, add this code:Place this reference between the '
' tags of your Web page code or just above the closing '
' tag.
Add a pair of 'Write all jQuery code between the '
' tags.
Write a function to check for when the document finishes loading. This is also known as the 'document ready' function:$(function () {});The above code is short-hand for '$(document).ready()'.
Declare an array type variable that will hold the class values of your '' tags:var tdValue = [];Add this code between the curly braces of the 'document ready' function.
Iterate through each instance of '' in the Web page code by creating an 'each()' loop:$('td').each(function(i) {});This code goes after the array declaration. Note that 'each()' attaches to the 'td' selector, and a variable 'i' is passed as a parameter in the function. You need the 'i' variable to get values from the array.
Set your array equal to the results of the 'attr()' function inside the 'each()' loop:tdValue[i] = $(this).attr('class');The 'this' selector gets the parent selector, in this case 'td' from the selector in the line of code above it. Use 'class' inside 'attr()' to get the value of the class attribute for each '' tag.
Output the class name for each '' tag as text in each table cell by adding this line of code after the line containing your 'attr()' function:$(this).text(tdValue[i]);The finished script should look like this:$(function() {var tdValue = [];$('td').each(function(i) {
tdValue[i] = $(this).attr('class');$(this).text(tdValue[i]);
});});
In Feburary 2016 18,
Open the Web page in Notepad or a code editor, and look for the jQuery library file. If your code contains no reference to this file, add this code:Place this reference between the '
' tags of your Web page code or just above the closing '
' tag.
Add a pair of 'Write all jQuery code between the '
' tags.
Write a function to check for when the document finishes loading. This is also known as the 'document ready' function:$(function () {});The above code is short-hand for '$(document).ready()'.
Declare an array type variable that will hold the class values of your '' tags:var tdValue = [];Add this code between the curly braces of the 'document ready' function.
Iterate through each instance of '' in the Web page code by creating an 'each()' loop:$('td').each(function(i) {});This code goes after the array declaration. Note that 'each()' attaches to the 'td' selector, and a variable 'i' is passed as a parameter in the function. You need the 'i' variable to get values from the array.
Set your array equal to the results of the 'attr()' function inside the 'each()' loop:tdValue[i] = $(this).attr('class');The 'this' selector gets the parent selector, in this case 'td' from the selector in the line of code above it. Use 'class' inside 'attr()' to get the value of the class attribute for each '' tag.
Output the class name for each '' tag as text in each table cell by adding this line of code after the line containing your 'attr()' function:$(this).text(tdValue[i]);The finished script should look like this:$(function() {var tdValue = [];$('td').each(function(i) {
tdValue[i] = $(this).attr('class');$(this).text(tdValue[i]);
});});
In Feburary 2016 18,
Sunday, 14 February 2016
How to Send an Email Through Telnet With an AttachmentIn Feburary 2016 14,
In Feburary 2016 14,
Run the Command prompt. This is achieved on any Windows PC through the typing 'cmd' in the 'Run' application under the 'Start' menu.
Type in the following command, keeping your email server details ready for insertion:telnet yourserver.com 25The only variable is yourserver.com, which you should modify to reflect the outgoing SMTP server on your email account.
Type the command 'EHLO yourserver.com' to begin typing your email, using the MAIL FROM, RCP TO and DATA commands, respectively, to type your message.
Encode your attachment through the MIME format, entering the header and content code within the DATA section of your email. This will allow your attached media to be sent over the text-based Telnet protocol, regardless of whether it's an image, an illustrated brochure or just plain text.
Type a period on an otherwise blank line beneath your email and hit return to send your message and attachment. If you receive an error message, check that you've inserted the correct commands with no typos and that your email addresses are correct.
Type the command 'QUIT' to end your Telnet connection.
In Feburary 2016 14,
Run the Command prompt. This is achieved on any Windows PC through the typing 'cmd' in the 'Run' application under the 'Start' menu.
Type in the following command, keeping your email server details ready for insertion:telnet yourserver.com 25The only variable is yourserver.com, which you should modify to reflect the outgoing SMTP server on your email account.
Type the command 'EHLO yourserver.com' to begin typing your email, using the MAIL FROM, RCP TO and DATA commands, respectively, to type your message.
Encode your attachment through the MIME format, entering the header and content code within the DATA section of your email. This will allow your attached media to be sent over the text-based Telnet protocol, regardless of whether it's an image, an illustrated brochure or just plain text.
Type a period on an otherwise blank line beneath your email and hit return to send your message and attachment. If you receive an error message, check that you've inserted the correct commands with no typos and that your email addresses are correct.
Type the command 'QUIT' to end your Telnet connection.
In Feburary 2016 14,
Subscribe to:
Posts (Atom)