User Profile

Collapse

Profile Sidebar

Collapse
mike4722
mike4722
Last Activity: Aug 29 '07, 06:04 AM
Joined: Aug 21 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • 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...
    See more | Go to post

    Leave a comment:


  • 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?...
    See more | Go to post

    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;...
    See more | Go to post
    Last edited by acoder; Aug 22 '07, 05:54 PM. Reason: Added code tags

    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...
    See more | Go to post
    Last edited by pbmods; Sep 3 '07, 06:31 PM. Reason: Added [CODE] tags.

    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...
    See more | Go to post

    Leave a comment:


  • mike4722
    started a topic How to pass HTML/php variable into JavaScript

    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...
    See more | Go to post
    Last edited by gits; Aug 21 '07, 09:18 PM. Reason: added code tags
No activity results to display
Show More
Working...