This is what caught me logically. If "Onload" is part of Javascript, and PHP generating the parameters for it, then they are two separate piece and the actual sequence of code line shall not be matter, right ?
Hence, it seems this "onLoad" tend to execute at the beginning of HTML form, not at the end of page reload.
Let's say, if I have HTML "radio button" preset with "checked" after...
User Profile
Collapse
-
Yes, u are hitting right on the nail... after I move $value section before the <body> tag, everything works great.
May be I was naive about this, I thought <body onload="> always has to be at top of HTML, and will be executed as last section of html code after form loaded?
<body onload="functio n()">, I was wrong obviously.
Any pointer on how "onload" is working?...Leave a comment:
-
Here's my testing script/html:
[HTML]<html>
<head>
<title>Configur ation Testing</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function autoForm(value) {
var myForm = document.forms["thisform"];
if (value == '1')
myForm.category[0].checked=true;...Leave a comment:
-
I tried the following three variation, none of them able to pass the value to JavaScript:
[code=html]
<body onload = "autoForm('<?ph p echo $value; ?>')">
<body onload = "autoForm(< ?php echo $value; ?>)">
<body onload = "autoForm(< ?php echo "$value"; ?>)">
[/code]
However, in HTML, this code[code=php]
<?php...Leave a comment:
-
Thanks for ur response.
I tried it either use single quotes inside the onload, or no quotes at all. Both doesn't make Javascript see the value the onLoad try to pass in.
<body onload = "autoForm($RRI) ;">
<body onload = "autoForm('$RRI ');">
However, in HTML/Php portion of code, if I did
echo "<hr><b>the RRI value is: ".$RRI." </b><br...Leave a comment:
-
How to pass HTML/php variable into JavaScript
I wish to have the form to be able to automatically select the radio button based on the logic of HTML/php variable. example show below:
javascript:
[CODE=javascript]function autoForm(value)
{
var myForm = document.forms["search"];
if (value == '1')
myForm.elements["category"][0].checked = true;
if (value == '0')
myForm.elements["category"][1].checked...
No activity results to display
Show More
Leave a comment: