Jump to content

grs5211

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Everything posted by grs5211

  1. I have an iframe object with an onload event which seems to fire multiple times and sometimes results in a stack overflow error. I have a combobox with an onchange="loadTemplate() event which populates the the iframe with a text file and reloads the page. This in turn fires the iframe onload to apply css formats. It then fires multiple times. If I leave out the document.close() line it works OK. However for printing the document needs to be fully loaded. Herein lays the issue. Here is the code. <select class="dropdown" id="templates" onchange="loadTemplate()">'; .......etc <iframe id="iView" name="previewFrame" width="100%" height="800px" onload="previewFrameOnLoad();"> </iframe> function loadtemplate() { var timestamp = new Date(); // cache buster document.getElementById("iView").src = document.getElementById"path").value + document.getElementById("templates").options[document.getElementById("templates").selectedIndex].text + "?timestamp=" + timestamp.getTime(); } function previewFrameOnLoad() { template = window.iView.document.body.innerHTML; var ifrm = document.getElementById('iView'); ifrm = (ifrm.contentWindow) ? ifrm.contentWindow : (ifrm.contentDocument.document) ? ifrm.contentDocument.document : ifrm.contentDocument; ifrm.document.open(); document.write('<link rel="stylesheet" type="text/css" href="/css/letterStyles.css" />' + template); ifrm.document.close() }
  2. Thanks for all the responses. I know this method is a bit unorthodox, but it would really solve the issue I have in this contect. Well..tried all the above, but the function was never fired. I have an alert in the function, but I don't see it. Testing the function with a button works just fine. Is there any reason why <?php echo "Last Modified by : " . "<script language=\"javascript\">extractmodifiedby();</script>"; ?> will not fire the function. This code is placed directly after the <form> tag.
  3. I have a function that gets the person who last modified a document. In simple terms here is the function. function extractModifiedBy() { var ModCode = 'It was John Doe that was here' ; //alert("Extract code=" + ModCode.substr(8,); return ModCode.substr(8,; } I wish to diaplay this value in a table row. When I run this code I get no result. <td colspan="1"> <?php echo "Last Modified by : " . "<SCRIPT LANGUAGE='javascript'>extractModifiedBy();</SCRIPT>" ?> </td>
  4. I get what you are saying here, but this assumes there is a processing loop to go through, which there is not. Lets say we are 'hard coding' every fruit known(thats a lot). We can't use the code at every <OPTION> line to decide if that is the one we want selected. Should we not do this after the <SELECT> is built?
  5. I have built a list with this code: <select id="moduleBox" name="selModule" style="align: center;" onChange="insertCode()"> <option value="A">Apple</option> <option value="L">Lemon</option> <option value="P">Peach</option> </select> I have brought over a query string variable from another page which has the value I want selected in ="selModule". Lets say the $_REQUEST("value") = "Lemon" How do I show this as the selected value in the listbox?
  6. Thanks . anupamsaha, I tried your code first and it did not compile. ken2k7, yours worked. Thanks to you both for responding.
  7. I want to send a variable concatenated with some text to a javascript function. Clearly this will work. echo "<SCRIPT LANGUAGE='javascript'>errorMessages('This is not a valid ID);</SCRIPT>"; However I want to do this: echo "<SCRIPT LANGUAGE='javascript'>errorMessages($_REQUEST["UserID"] + ' is not a valid ID);</SCRIPT>"; Any ideas?
  8. I have this code: $dir_handle = opendir($path) or die("Unable to open $path"); What I want to do is goto a javascript function if the path fails instead of just the message output. I would like to do this: $dir_handle = opendir($path) or die(execute my 'function'); Any thoughts!!
  9. I have filled an Input box with a value obtained by getting a cookie value at the start of code. This works fine. Now I want to input "aCode" with this value within the same form. Here is the code to get the cookie, which works, but the rest does not. NB. I am new to PHP. <head> function checkCookie() { if(document.getElementById("userid").value == "") { cookieCASUserIDValue = getCookie("CUserID"); if(cookieCASUserIDValue != null) { document.getElementById("userid").value = getCookie("CUserID"); } } </head> <body class="gradient" onLoad="checkCookie();"> <form id="gData" name="gData" method="POST"> <input type="text" id="userid" name="userid" size=8 >' /> <input type="text" name="aCode" id="aCode" style="display: none;" value=document.getElementById("userid").value> </input> </form> } At this stage I wish to get the value of the element "userid" and and display it. Here is my code that does not wotk. <?php error_reporting(1); // Only display error messages, not warnings and notices. echo "UserID = " . $_REQUEST["userid"]; . "<br>"; ?> Can anyone help!
×
×
  • 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.