Skip to content Skip to sidebar Skip to footer

It Doesn't Work (html And Javascript And Iframe)

Related.. (HTML, JAVASCRIPT, Iframe) I add code into Iframe's element using javascript(Dynamically.). After I set all of things. JavaScript in Iframe doesn't work( onclick=functio

Solution 1:

I think it's just my mistake.

-- If someone want to refer javascript function in iframe. iframe must refer source code which define function that component in body refer...

this is my solution..

  1. In 'view.py', define index s

    def upload_file(request):
        context = {'source_list':source_list,'menu_list':menu_list, 'form':fileform, 'index':1}
        return render(request, 'encyclopedia/maintab.html', context) 
    
  2. In '(template document name).html', define what to do according to index.

    {% if index == 0 %}
        <a id="nav-{{service.menu}}-tab" class="nav-item nav-link active" role="tab" data-toggle="tab" aria-controls="{{service.menu}}-tab" href="#{{service.menu}}-tab">
              목록 보기(<- this is korean. In English "show list...")
        </a>
    {% elif index == 1 %}
        <a id="nav-{{service.menu}}-tab" class="nav-item nav-link" role="tab" data-toggle="tab" aria-controls="{{service.menu}}-tab" href="#{{service.menu}}-tab">
              목록 보기(<- this is korean. In English "show list...")
        </a>
    {% endif %}
    
  3. Don't forgot to define iframe like below

    <form class="form-horizontal" method ="POST" action="./upload" >
        ...
        <input type="submit" id="transferbutton" value="vvvvvvvvvvvvvvv"/>
    </form>
    
  4. In 'Urls.py'

    urlpatterns = [
        url(r'^encylopedia/index$', views.index, name='index'),
        url(r'^upload$', views.upload_file, name='upload_file'),
        url(r'^$', views.index, name='index'),
    ]
    

It is difficult to understand Django framework... thnks.

but it makes some blink... when click button.


Post a Comment for "It Doesn't Work (html And Javascript And Iframe)"