how to make html generated code

Discussion in 'Programming' started by cong, Jan 17, 2008.

  1. #1
    hello

    I want to know how to make html generated code like in this image:

    [​IMG]


    I am beginner in php. I make simple code that generate alexa rank for visitors
    but i don't know how to make them take the result to there page. I think it by java script and ajax


    can you supply me with how to make it with details or supply my with useful links to do this
     
    cong, Jan 17, 2008 IP
  2. krzyk

    krzyk Peon

    Messages:
    61
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Do you want to generate an iframe with the code?
    Or maybe you want it to update the automatically the image below?
     
    krzyk, Jan 17, 2008 IP
  3. cong

    cong Peon

    Messages:
    165
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I want to generate both of them if he copy paste the code in the iframe it will be shown the image below
     
    cong, Jan 17, 2008 IP
  4. krzyk

    krzyk Peon

    Messages:
    61
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Well, if I understand you right:
    You want to be able to enter some HTML in the box, and get it rendered in some other place on the page?


    If so, then...

    1. Define where you want the rendered HTML to appear, e.g.:
    <div id="myDiv" name="myDiv"></div>

    2. Install some handler for the onChange event in the textarea box (I thought at first it is an iframe, sorry for this)


    e.g. <textarea id="myHtml" name="myHtml" onChange="someMethod(this)"></textarea>

    3. Define javascript method such as:

    function someMethod(field)
    {
    document.getElementById("myDiv").innerHtml = field.value;
    }


    That should do the trick.
     
    krzyk, Jan 17, 2008 IP
    cong likes this.
  5. cong

    cong Peon

    Messages:
    165
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #5
    you may be didn't understand me

    when user visit the page will enter his site name and the result will be his alexa rank this part is finished with php

    I want to attach html code with the result to him to be easy to him to put updated image with the result on his site

    so the visitor will put his site and get

    1- his alexa rank "finished"
    2- generated code state his rank he can put it in his site with simple copy and paste step "I want this"

    [​IMG]
     
    cong, Jan 17, 2008 IP