Showing posts with label argument. Show all posts
Showing posts with label argument. Show all posts

Sunday, 28 February 2016

How to Change HTML Text With JavaScript VariablesIn Feburary 2016 28,

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,

Tuesday, 16 February 2016

How to Convert Epoch Time in C++In Feburary 2016 16,

In Feburary 2016 16,
Include the C++ standard library's time functionality into your application. Add the following line to the top of your include list:include
Obtain the seconds elapsed since the epoch, and store it locally. Do this by calling time(), and storing the result into an object of type time_t. The time function also accepts a pointer to an object of type time_t as an argument, but it is simpler to store this object locally on the stack:time_t timeSinceEpoch = time(NULL);
Create a time structure to store the result of the time conversion. This structure is defined in the time.h header file as a structure named tm, and provides conveniently-named member variables for each component of the converted time:tm timeResult;
Use one of the built-in conversion functions to store the time_t value obtained earlier as a tm structure. For simplicity, the following code converts a time_t object into a UTC tm structure:timeResult = gmtime( &timeSinceEpoch );
In Feburary 2016 16,