- Impact
- 19
Hey
I got 1 javascript and 1 html question..
html:
when i m making the FILE input field...is there a way to edit how the "Browse" button looks like? i applied a style to the FILE input field but the browse button stays the same...heres the code:
and heres the javascript question:
i have a code that expands a div..but to do so..it still refreshes page [i noticed it cuz in that page..it plays a video..and when some1 expands the div..it refreshs the page] is there a way to have the same expand and collapse effect ..but without refreshing the page?
heres the code:
and heres the javascript:
I got 1 javascript and 1 html question..
html:
when i m making the FILE input field...is there a way to edit how the "Browse" button looks like? i applied a style to the FILE input field but the browse button stays the same...heres the code:
PHP:
<tr><td><p id="field">Thumbnail/Screenshot:</p></td><td><input type="file" name="thumb" value="<? echo $form->value("thumb"); ?>" class="form_field" / ></td></tr>
and heres the javascript question:
i have a code that expands a div..but to do so..it still refreshes page [i noticed it cuz in that page..it plays a video..and when some1 expands the div..it refreshs the page] is there a way to have the same expand and collapse effect ..but without refreshing the page?
heres the code:
PHP:
<div onClick="expandcontent('add')" style="display: inline;"><a href="#"> Add a Comment</a></div></p>
<div style="display: none;" id="add" >
<?php if ($session->logged_in){?>
<form action="process.php" method="post">
<textarea name="comment" cols="65" rows="3" maxlength="150" onkeyup="return ismaxlength(this)" class="text_area"></textarea>
<br /><p id="text">MaxLength: [150]</p><br />
<input type="hidden" name="subcomment" value="1">
<input type="hidden" name="mid" value="<?=$media_id?>">
<input type="hidden" name="url" value="<?=$_SERVER['PHP_SELF'].'?' . $_SERVER['QUERY_STRING']?>">
<input type="hidden" name="uid" value="<?=$database->get_uid($session->username);?>">
<input type="submit" value="Add Comment" class="button" />
</form>
<?} else{ echo "<p id='text'>You must login to add a comment</p>";}?>
</div>
Code:
/* EXPANDABLE DIVS */
function expandcontent(div_id)
{
document.getElementById(div_id).style.display=(document.getElementById(div_id).style.display!="block")? "block" : "none"
}
function ismaxlength(obj){
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
if (obj.getAttribute && obj.value.length>mlength)
obj.value=obj.value.substring(0,mlength)
}






