Welcome visitor
* Login
* Register
It is currently November 18th, 2019, 4:00 pm
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Client Side » JavaScript



Post new topic Reply to topic  [ 2 posts ] 
Author Message
  help with javascript
PostPosted: July 17th, 2009, 12:31 pm 
User avatar

Posts: 70
Hi, lets see if this is possible and you can help me do it.

This should be done with javascript cause im not allowed to use php or asp nor any other server side language.

I have a form with one input only and i want it to have a max length of 120 characters and when the 120 characters are typed in or when the submit button is pressed then it should appear below a text another user previously typed in. And i only want it to make it visible as long as that page is opened, not a server side update.

Any help is greatly appreciated, thanks.


Top
 Profile  
 
  Re: help with javascript
PostPosted: July 17th, 2009, 1:17 pm 
User avatar

Posts: 81
<head>
<title></title>
<script type="text/javascript">
    function sendThis(l){
    if(document.getElementById('inputxt').value.length==l)
        {document.form.submit();}}
</script>
</head>
<body>
<form name="form" action="sin inputt.htm" method="GET">
  <input type="text" maxlength="120" onkeyup="sendThis(120)"
  name="input" id="inputxt" />
  <input type="submit" />
</form>
</body>

And create on the action target, sin inputt.htm on this case, add this
<head>
<title></title>
<script type="text/javascript">
var u=document.location.href;
function getVar(){
document.getElementById('yourPost').innerHTML=u.substr(u.search(/=/)+1);
}
</script>
</head>
<body onload="getVar()">
PREVIOUS POSTS
<div id="yourPost"></div>
</body>


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

FORUMS » Client Side » JavaScript


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron