Jump to content
Sign in to follow this  
nree

Utvide / minske textarea med knapper..

Recommended Posts

Hei :) , jeg har textarea som jeg vil at folk som besøker siden kan utvide/minske med noen enkle trykk..

 

Jeg har satt inn dette i kodinga mi:

<input onclick="increment_rows('comments', +3);return false;" value="+" type="button" />
<input onclick="increment_rows('comments', -3);return false;" value="-" type="button" />
<textarea cols="60" rows="7" name="comments" tabindex="3"></textarea></p>

 

Og dette scriptet:

function increment_rows(id, incr) {
minVal = 7

if(!incr) {
 incr = 3;
}

elem = document.getElementById(id);

if( (elem.rows + incr) >= minVal) {
 elem.rows += incr;
}
}

 

Det eneste problemet er at det ikke funker i Firefox, det funker i IE og Opera :confused: ..

Noen som vet hvorfor?

 

Se siden her.

Denne siden med samme script funker i firefox.

 

 

EDIT: Javascript er ikke HTML

 fjernet..
Edited by goggen90

Share this post


Link to post

<input onclick="increment_rows('comments');return false;" value="+" type="button" />
<input onclick="increment_rows('comments', -3);return false;" value="-" type="button" />
<textarea cols="60" rows="7" name="comments" tabindex="3" id="comments"></textarea></p>

Should work?

Edited by Jibril2k

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...