** EDIT **
I'm afraid I wasn't in the right direction - the problem isn't what I asked about. the Javascript works as it should, it's the PHP that doesn't show what I want it to on the first "run" - and I'm stil not sure why. Sorry for somewhat wasting your time...
**
I have a form that might or might not already contain data in its fields. If a user reaches the form and he already has some data in the system, his ID number, for instance, will appear in the ID field - and a JavaScript function running onLoad will disable the input field and change its style:
<body onload="runFunction()">
the problem is that it seems to run before the PHP does its part, and only if I refresh the page, the JS function does everything I want it to (it disables and styles some other form fields that depend on a PHP condition).
Is there a way to have this JS function run AFTER the page was rendered? I tried running this before closing the page:
<body>
...
...
<script>
runFunction();
</script>
</body>
</html>
ama boşuna.
any ideas? Thanks!
İlgili PHP kod bazı: [I kaldırıldı id okuma kolaylaştırmak için bağlıyor]
<?php if ($h_phone != '' && $h_phone_pre != '') {
echo "<td class=\"input\"><input type=\"text\" id=\"new_user_home_tel\" value=\"$h_phone\" size=\"8\" maxlength=\"7\" disabled=\"disabled\" /> -
<select id=\"new_user_home_tel_pre\" disabled=\"disabled\">
<option value=\"$h_phone_pre\" selected=\"selected\"></option>";
} else {
echo '<td class="input"><input type="text" id="new_user_home_tel" size="8" maxlength="7" /> -
<select id="new_user_home_tel_pre">
<option value=" " selected="selected"></option>';
}?> <option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="08">08</option>
<option value="09">09</option>
</select>
</td>
the Javascript code just changes the style if the field isn't empty and that works, but the PHP works only after a refresh.