so in the file rob.py i have functions for trnaslating text from and
to the robbers language.

so i need to call these functions from the javascript or access them/
pass the info on some other way.

how can i do this?

i guess it is possible to use regexps in  javascript but i dont want
to do that.



import web
import rob

render = web.template.render('templates/')

urls = (
  '/', 'main',
  )

class main:
    def GET(self):
        print render.main()

##    def POST(self):
##        i = web.input()
##        print rob.encrypt(i.enc)
##        if i.encdec == "encrypt":
##            print rob.encrypt(i.enc)
##        else:
##            print rob.decrypt(i.enc)

web.webapi.internalerror = web.debugerror
if __name__ == "__main__": web.run(urls, globals())





<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
TR/html4/strict.dtd">
<html>
<head>

<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >

<title>robber's language</title>
<style type="text/css">
<!--
body {
  margin: 0px;
  padding: 0px;
}
#header {
  background: #FDD017;
  width: 100%;
  height: 10%;
  font-size: xx-large;
  text-align: center;
}
#content {
  background: white;
  float: right;
  width: 100%;
  height: 90%;
  text-align: center;
}
a:link {color: black; }
a:visited {color: white; }
a:hover {color: black; }
a:active {color: black; }
-->
</style>
</head>
<body>

<div id="header">
        <b>Robber's language encrypter/decrypter</b>
</div>

<div id="content">

    <form action="..." onsubmit="return handleSubmit(this)">
    <script type="text/javascript">
        function handleSubmit(f)
        {
            f.elements['target'].value = f.elements['source'].value;
            return false;
        }
    </script>
    <div><textarea name="source" cols="60" rows="10"></textarea></div>
    <div><input type="submit" value="translate"></div>
    <div><textarea name="target" cols="60" rows="10"></textarea></div>
  </form>
</div>

</body>
</html>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to