views:

85

answers:

2

I have a html form for uploading a file, which is as follows:

$uploadhtml = htmlspecialchars(json_encode("<form action='up.php' method='post'
enctype='multipart/form-data'>
<label for='file'>Filename:</label>
<input type='file' name='file' id='file'/> 
<br />
<input type='hidden' name='pk' value='".$pk."'>
<input type='hidden' name='username' value='".$USERNAME."'>
<input type='submit' name='submit' value='Submit' onclick= />
</form>"), ENT_QUOTES);

I would like to know if it is possible to call the setTimeout function to update a particular layer, like follows:

onclick="setTimeout('updateLayer("text", "ff", "ok"))',1250);"

updateLayer takes 3 variables as arguments, how would I specify them as parameters within quotes?

+3  A: 

Something like this:

onclick="setTimeout(function() { updateLayer('text', 'ff', 'ok'); } ),1250);"
Kamarey
+2  A: 

You can also backslash the quotes. Note that this only works with " qoutes and not ' quotes in php, but works with both quotes in javascript:

onclick="setTimeout(function() { updateLayer(\"text\", \"your's\", \"ok\"); } ),1250);"
Marius