Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8171113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:21:30+00:00 2026-06-06T21:21:30+00:00

I am currently writing a text to HTML converter that’s supposed to: Get input

  • 0

I am currently writing a text to HTML converter that’s supposed to:

Get input from text box 1.

Split that input into the elements of an array by paragraph. (I define the paragraph by anything that has text and ends with /n)

Iterate through the array and add <p style=\"font-size: 13px; text-indent: 15px;\"> to the front of every element and </p> to the end.

Get input from text box 2. (supposed to be single line)

add <p style=\"font-size: 11px; color: #666666; text-align: left; margin-top: 30px;\">A Power News :> in front and </p> to the end.

Output both of the into a text box.

The code I have written is as follows:

HTML:

<form name="input" method="get">
Input the text here:<textarea cols="40" rows="5" name="bodyText" id = "bodyText" > </textarea><br />
Input Author Name:<input type="text" name="authorName" id = "authorName" />
<button type="button"value="Convert" onclick="convertBlog()">Click to convert to html template</button>
</form>
<textarea cols="110" rows="40" name="output" id= "output">  </textarea>

JavaScript:

//STATIC VARIABLES USED FOR THE START AND END OF THE HTML LINES
var blogParagraphStart = "<p style=\"font-size: 13px; text-indent: 15px;\">";
var authorParagraphStart = "<p style=\"font-size: 11px; color: #666666; text-align: left; margin-top: 30px;\">A Power News 記者: "
var paragraphEnd = "</p>"

//GET THE INPUT FROM THE USER AND ASSIGN THEM TO VARIABLES
var bodyTxt = document.forms["input"]["bodyText"].value;
var authorName = document.forms["input"]["authorName"].value;

var bodyArray=str.split("\n"); 


var end = bodyArray.length+1;

while (i<end){
bodyArray[i] = blogParagraphStart + bodyArray[i] + paragraphEnd;
i++;
}

var reporterOutputString = authorParagraphStart + authorName +paragraphEnd ;

var outputString = bodyArray+ reporterOutputString;

document.getElementById("output").innerHTML= outputString ;

For some reason this doesn’t work the button does nothing and I haven’t been able to figure this out.

I hope I clearly explained my situation. This converter is only for a very specific use so re-usability is not a concern.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T21:21:33+00:00Added an answer on June 6, 2026 at 9:21 pm

    Are you getting any javascript errors in the console? I’m not seeing in your code where “str” is defined from the line var bodyArray = str.split("\n");

    Also it seems since bodyArray is an array you would need to call join() on it before throwing it into a string?

    Also, i is never declared for your while loop.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently writing an Android app that, among other things, uses text information
I'm currently writing a Java app that interfaces with a MySQL database. My problem
I'm currently writing an app in Android that works with the GPS. At the
So i'm writing a quick perl script that cleans up some HTML code and
I'm currently writing a function for parsing some HTML and adding tags where necessary.
I currently have an application that calls creates and displays charts from various objects'
I am currently writing a text-adventure type game in Malbolge. Can anyone tell me
I am currently writing many chunks of text on an NSView using the NSString
I have an application that I am currently writing that works by iterating through
I'm busy writing a servlet that generates HTML code. The goal is to create

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.