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

  • Home
  • SEARCH
  • 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 6195513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:28:52+00:00 2026-05-24T03:28:52+00:00

This problem is about Javascript writing HTML code for video player. I think there

  • 0

This problem is about Javascript writing HTML code for video player. I think there are some faster methods(document.createElement,Jquery and etc). Please tell some better and faster methods for this procedure. Thanks in advance

    function createPlayer(videoSource){
            document.writeln("<div id=\"player\">");
            document.writeln("<object width=\"489\" height=\"414\" >");
            document.writeln("<param name=\"player\" value=\"bin-    debug/FlexPlayer.swf\">");
           //etc
            document.writeln("</embed>");
            document.writeln("</object>");
            document.writeln("</div>");               
    }
  • 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-05-24T03:28:53+00:00Added an answer on May 24, 2026 at 3:28 am

    There is a jQuery function I know of that allows you to create a template HTML snippet which you can later use repeatedly with only 1 or 2 lines of code, adding in variables and appending it to the page.

    For this you will need jQuery (latest should be fine) http://jquery.com/

    Docs for the tmpl function are here: http://api.jquery.com/jquery.tmpl/

    For details on how to use it you’d be best reading an example on the jQuery docs, I’ve not used it myself so can’t write you a good example but there is great stuff on the docs site.

    Hope this helps

    EDIT:
    A less resource intensive way to acheive that function would be to, rather than writing each line in turn to the document, just append them all to a string and then write that once when you are finished.

    Eg:

    function createPlayer(videoSource){
                var html="<div id=\"player\">";
                html+="<object width=\"489\" height=\"414\" >";
    
                //etc            
                document.writeln(html);               
        }
    

    This is faster because writing a line to the document uses more resources than just appending a string in memory. For MAXIMUM SPEED you could even declare the html var outside of the function and just set it to the markup as one long string, then write it – i.e

    var html;
     function createPlayer(videoSource){
                    html="<div id=\"player\"><object width=\"489\" height=\"414\" >"; //and so forth           
    
                    document.writeln(html);               
            }
    

    If you can justify the larger download sizes I’d go for the jQuery solution if possible, it’s generally a bit more manageable – I’ve done plenty script generated HTML in the past and it very quickly becomes a pain to maintain. Good luck

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

Sidebar

Related Questions

I've been wondering about this problem for some time - doubleclicking a winforms TabControl's
[Note: There is another thread about this problem but it did not answer the
I noticed some similar questions about this problem when I typed the title, but
There was this problem that has been asked about implementing a load byte into
Lately I've been writing some JS code using jQuery and JavaScript as it is
I'm writing a Javascript <-> C# bridge and ran into the following problem: There's
Please help me to refactore this Javascript code. There is big form for scheduled
I have hit upon this problem about whether to use bignums in my language
I've been thinking about this problem for a while and have yet to come
I don't know where to look for about this problem ... I have three

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.