longtone Posted September 8, 2008 Share Posted September 8, 2008 Having previously hidden div id="descbox" with the code: function hide(o) { o.className = 'hidden'; } I now want to unhide it with: function unhide(o) { o.className = ''; } Called from the AJAX form generated with this PHP: <?php $youtuberef = (isset($_GET['youtuberef'])) ? $_GET['youtuberef'] : false; $comment_id = (isset($_GET['comment_id'])) ? $_GET['comment_id'] : 0; $author = (isset($_GET['author'])) ? $_GET['author'] : false; $content_hint = (isset($_GET['content_hint'])) ? $_GET['content_hint'] : false; $label = ($comment_id) ? 'Reply to this comment: ' :'Comment on this video' ; echo <<<heredoc <form id="post_comment_form" > <p> <label for="comment_text">$label</label> <textarea rows="4" cols="40" name="post_comment_text" id="post_comment_text" oninput="CountLeft(this.form.post_comment_text, this.form.left,480);" onkeyup="CountLeft(this.form.post_comment_text, this.form.left,480);" onpaste="CountLeft(this.form.post_comment_text, this.form.left,480);"></textarea> </p> <p> <input type="button" onclick="ajaxPostCommentText('$youtuberef', '$comment_id'); unhide(document.getElementById('descbox')); " value="Post Comment" /> <input type="button" onclick="discardComments('$youtuberef', '$comment_id'); unhide(document.getElementById('descbox')) ; resetLength(document.getElementById('commentbox').getElementsByTagName('div')[1], document.getElementById('descbox').getElementsByTagName('div')[0])" value="Discard" /> <input readonly type="text" name="left" class="charactercount" size="3" maxlength="3" value="480"/> characters remaining</p> </form> heredoc; ?> And inserted with innerHTML It works as expected in FF and Safari, but the div stays hidden in IE6 and IE7. I also noticed that the outputted code is slightly altered. Could that be the problem? Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted September 8, 2008 Share Posted September 8, 2008 Instead of changing the class, you could just do it like this: function hide(o) { o.style.visibility = 'hidden'; } function unhide(o) { o.style.visibility = 'visible'; } Quote Link to comment Share on other sites More sharing options...
longtone Posted September 8, 2008 Author Share Posted September 8, 2008 I'd like to say how I fixed this, but I don't really know. I fixed an error somewhere else on the page and now it all works... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.