Simple: How do you show large amounts of HTML easily with JS

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
lavaeagle
Forum Newbie
Posts: 21
Joined: Thu Sep 09, 2010 1:41 pm

Simple: How do you show large amounts of HTML easily with JS

Post by lavaeagle »

I have to generate a lot of HTML with some Javascript DOM to make a form, so when the user wants another upload spot or something they can just click add.

Thats not the problem I know how to do that, but I don't want to go through the html I'm generating and put \ in front of every single quotation mark.

For example in php I might:

Code: Select all

<? while ( $fish = 2 ){
 ?>
     A lot of HTML that will never stop!
<? 
} ?>
Note the ?> HTML STUFFS <?

Thank you!
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Simple: How do you show large amounts of HTML easily wit

Post by AbraCadaver »

You'll have to give an example as I don't see where or when you will need to escape quotes:

[text]var html = '<form method="post" action="index.php">';[/text]
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
lavaeagle
Forum Newbie
Posts: 21
Joined: Thu Sep 09, 2010 1:41 pm

Re: Simple: How do you show large amounts of HTML easily wit

Post by lavaeagle »

Code: Select all


<?

//include('inc/sql.php');

?>

<style type="text/css">
    .dynamicDiv {
    width:200px;
    height:100px;
    border:solid 1px #c0c0c0;
    background-color:#e1e1e1;
    font-size:11px;
    font-family:verdana;
    color:#000;
    padding:5px;
    }
</style>

<script type="text/javascript" language="javascript">
    function createDiv()
    {
        var divTag = document.createElement("div");
        divTag.id = "div1";
        divTag.setAttribute("align","center");
        divTag.style.margin = "0px auto";
        divTag.className ="dynamicDiv";
        divTag.innerHTML = "I have a lot of html and possible database stuff that would create a form right here, kind of like when you add a new upload file submit.";
        document.body.appendChild(divTag);
    }
</script>

    <p align="center">
        <b>Click this button to create div element dynamically:</b>
        <input id="btn1" type="button" value="create div" onclick="createDiv();" />
    </p>

Post Reply