Jump to content

[SOLVED] Calling JS from AJAX form, not working in IE


longtone

Recommended Posts

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.