How to get html to work in a javascript file?

Discussion in 'HTML & Website Design' started by electroze, Dec 29, 2010.

  1. #1
    Does anyone know how to get regular html to work inside .js file?

    The reason is I made a widget I want others to use, but I don't know how to convert to .js. Is there a simple way to convert it, or does it completely have to be rewritten?
     
    electroze, Dec 29, 2010 IP
  2. AssistantX

    AssistantX Peon

    Messages:
    173
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The amount of information you gave in this post is definitely not enough. However, I'll assume you're talking about the same issue in this other post of yours.

    Since the method I am giving involves little programming, I will attempt to answer your question here instead of on your other post.

    The method used by that widget system to display the section you desired is that it writes into the page an iframe that loads the biblesearchwidget.php page on your website. Their system also inserts a Flash "Get Widget" button. Is it that you don't want the "Get Widget" button? Regardless, the simplest way you can do the iframe technique yourself and still use a .js file is to empty the biblesearchwidget.js file you have and insert the following code.

    document.write("<iframe src=\"http://www.kingjamesbibleonline.org/biblesearchwidget.php\" style=\"width: 200px; height: 200px; border: none;\"></iframe>");
    Code (markup):
    For the most part, it should work fine. Of course there are extra things you can add like element wrappers, id's, and DOM operations, but the method I gave is pretty much the minimum.
     
    AssistantX, Dec 29, 2010 IP
  3. electroze

    electroze Active Member

    Messages:
    179
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Awesome, that worked like a charm! Thanks so much!
     
    electroze, Dec 29, 2010 IP