#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Location
    Turin/Milan/Verona, Italy
    Posts
    4
    Rep Power
    0

    Javascript issues on Python


    Hi guys,
    i'm pleased to be here and i hope that somebody of you could solve this issue:
    I'm developing a portal for students for a university assignment.
    I've got an interactive dynamic navigation menu (JavaScript) and i've coded all the structure of the portal in HTML using CSS for designing the layout. I'm trying to embed everything inside a Python program but although i have understood how to display the menu i'm not able to make the javascript run in order to have such beautiful sliding icons menu that i've created.

    Here's the Python program:

    Code:
    from bottle import route, run
    
    @route('/home')
    def homepage():
    
        init= "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>"
        init1="<html>"
        init2="<head>"
        init3="<title>Compy/homepage</title>"
        init4="<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>"
        init5="<link rel='stylesheet' href='css/homepage.css' type='text/css' charset='utf-8'/>"
        init6="</head>"
        init7="<style>"
        init8="body{"
        init9="margin:0px;"
        init10="padding:0px;"
        init11="background-color:#f0f0f0;"
        init12="font-family:Arial;"
        init13="}"
        init14=".back{"
        init15="display:block;"
        init16="background:transparent url(back.png) no-repeat top left;"
        init17="width:281px;"
        init18="height:143px;"
        init19="}"
        init20="a.dry{"
        init21="position:absolute;"
        init22="bottom:10px;"
        init23="right:10px;"
        init24="color:#000;"
        init25="font-weight:bold;"
        init26="font-size:16px;"
        init27="}"
        init28="</style>"
        init29="<body>"
        init30="<div id='prova'>"
        init31="<p>Universities</p>"
        init32="</div>"
        init33="<div class='navigation'>"
        init34="<ul class='menu' id='menu'>"
        init35="<li><span class='lock'></span><a href='login.html' class='first'>Login</a></li>"
        init36="<li><span class='uni'></span><a href='universities.html'>Universities</a></li>"
        init37="<li><span class='ruler'></span><a href='highschool.html'>HighSchool</a></li>"
        init38="<li><span class='cap'\></span><a href='stages.html'>Stages</a></li>"
        init39="<li><span class='checkbox'></span><a href='thesis.html'>Thesis</a></li>"
        init40="<li><span class='house'></span><a href='rents.html'>Rents</a></li>"
        init41="<li><span class='diagram'></span><a href='booksandmag.html'>Books&Mag</a></li>"
        init41="<li><span class='hands'></span><a href='forum.html' class='last'>Forum</a></li>"
        init42="</ul>"
        init43="</div>"
        init44="<script type='text/javascript' src='jquery-1.3.2.js'></script>"
        init45="<script type='text/javascrip'>"
        init46="$(function() {"
        init47="var d=1000;"
        init48="$('#menu span').each(function(){"
        init49="$(this).stop().animate({"
        init50="'top':'-17px'"
        init51="},d+=250);"
        init52="});"
        init53="$('#menu > li').hover("
        init54="function () {"
        init55="var $this = $(this);"
        init56="$('a',$this).addClass('hover');"
        init57="$('span',$this).stop().animate({'top':'40px'},300).css({'zIndex':'10'});"
        init58="},"
        init59="function () {"
        init60="var $this = $(this);"
        init61="$('a',$this).removeClass('hover');"
        init62="$('span',$this).stop().animate({'top':'-17px'},800).css({'zIndex':'-1'});"
        init63="}"
        init64=");"
        init65="});"
        init66="</script>"
        init67="<h1 class='cs-text'>"
        init68="<span>C</span>"
        init69="<span>O</span>"
        init70="<span>M</span>"
        init71="<span>P</span>"
        init72="<span>Y</span>"
        init73="<span></span>"
        init74="</h1>"
        init75="</div>"
        init76="</body>"
        final="</html>"
    
        
        return init, init1, init2, init3, init4, init5, init6, init7, init8, init9, init10, init11, init12, init13, init14, init15, init16, init17, init18, init19, init20, init21, init22, init23, init24, init25, init26, init27, init28, init29, init30, init31, init32, init33, init34, init35, init36, init37, init38, init39, init40, init41, init42, init43, init44, init45, init46, init47, init48, init49, init50, init51, init52, init53, init54, init55, init56, init57, init58, init59, init60, init61, init62, init63, init64, init65, init66, init67, init68, init69, init70, init71, init72, init73, init74, init75, init76, final
    
    run(host='localhost', port=8080, debug=True)
    Thanks for your help!

    Gabriele
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Location
    Turin/Milan/Verona, Italy
    Posts
    4
    Rep Power
    0
    Up!
  4. #3
  5. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,995
    Rep Power
    481
    Sorry, I read your post and have little clue about a solution or understanding as a whole.

    "I'm developing a portal for students" --- something to do with the internet.

    " for a university assignment." --- Understood. I've partaken in university assignments.

    "I've got an interactive dynamic navigation menu (JavaScript)" --- ok, I've started to work through a javascript book.

    " and i've coded all the structure of the portal in HTML using CSS for designing the layout." --- I'm okay with this. Sounds reasonable.

    " I'm trying to embed everything inside a Python program" --- Why? What? Where does this python program run? Server? Client? I guess I'm lost here.


    "... but although i have understood how to display the menu i'm not able to make the javascript run in order to have such beautiful sliding icons menu that i've created." --- where would I find your beautiful sliding icon?
    [code]Code tags[/code] are essential for python code and Makefiles!
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Location
    Turin/Milan/Verona, Italy
    Posts
    4
    Rep Power
    0
    Originally Posted by b49P23TIvg
    Sorry, I read your post and have little clue about a solution or understanding as a whole.

    "I'm developing a portal for students" --- something to do with the internet.

    " for a university assignment." --- Understood. I've partaken in university assignments.

    "I've got an interactive dynamic navigation menu (JavaScript)" --- ok, I've started to work through a javascript book.

    " and i've coded all the structure of the portal in HTML using CSS for designing the layout." --- I'm okay with this. Sounds reasonable.

    " I'm trying to embed everything inside a Python program" --- Why? What? Where does this python program run? Server? Client? I guess I'm lost here.


    "... but although i have understood how to display the menu i'm not able to make the javascript run in order to have such beautiful sliding icons menu that i've created." --- where would I find your beautiful sliding icon?
    Yeah, you're right, i didn't explain it in details, so:
    I've forgotten to tell you that we run XAMPP, we use Apache and MySQL to deal with the databases created in phpMyAdmin and we finally use Python in order to read those databases in our website. Using Python is not mandatory but strongly suggested by the professor. We then created the structure i told you. It seems that i cannot post pics because i'm a new user of the forum so then i cannot show you what's the sliding icons menu i'm talking about.
  8. #5
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Location
    39N 104.28W
    Posts
    158
    Rep Power
    3
    It sounds to me like you're using Python on the server side, particularly the http://docs.python.org/2/library/cgi.html CGI module. That's pretty straightforward but has nothing to do with the widgets on the web page. Things like sliders and inputs will be controlled by the HTML and Javascript. The CGI will navigate between pages with variables in the form of: <url>?<variable name>=<value>&<variable name>=<value>...
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Location
    Turin/Milan/Verona, Italy
    Posts
    4
    Rep Power
    0
    Originally Posted by rrashkin
    It sounds to me like you're using Python on the server side, particularly the CGI module. That's pretty straightforward but has nothing to do with the widgets on the web page. Things like sliders and inputs will be controlled by the HTML and Javascript. The CGI will navigate between pages with variables in the form of: <url>?<variable name>=<value>&<variable name>=<value>...
    Thanks for the reply but although the browser read the HTML & the JavaScript code it does not implement it correctly. I just see a bulleted list instead of the sliding icons menu.

IMN logo majestic logo threadwatch logo seochat tools logo